How can i create runtime User DSN through the vb.net2005

In My project, I am making connection throught code, and for report, I m using User DSN (ODBC). for reports only, i have to make User DSN on all the client, but i don't want this,
Note: How can i I make User DSN Throug Code?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I am not sure you can.  Making a DSN requires ADMIN privileges which most users won't have.

Can you build it against a system dsn that all users can have access to?

Éric MoreauSenior .Net ConsultantCommented:
mahmood66Author Commented:
I will give you clear picture, I have created connection with sqlserver with the help of code, but reports case I am using ODBC (User DSN), I want in Clients sytems, ther should not be ODBC (User DSN), their systems should create automatically, when they run my application. Please help me.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Éric MoreauSenior .Net ConsultantCommented:
why isn't my link OK?
mahmood66Author Commented:
For your information,

In Your link i could not find ODBC for SQL Server, There is ODBC with Ms acess. My database is in Server. not in file system.
Please help me How to make ODBC (User DSN) for SQL Server.
I will be very thankful to u.
Éric MoreauSenior .Net ConsultantCommented:

Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
       If TextBox1.Text = "[Server Name]" Or TextBox1.Text = "" Then
           MsgBox("Inserte Server Name.", MsgBoxStyle.Information)
           Exit Sub
       End If
       If TextBox2.Text = "[Database Name]" Or TextBox2.Text = "" Then
           MsgBox("Insert Database Name.", MsgBoxStyle.Information)
           Exit Sub
       End If

       Dim iReturn As Integer
       Dim Attr As String
       Dim machName As String = Trim(TextBox1.Text)          'Server Name.
       Dim catelog As String = Trim(TextBox2.Text)

       Attr = "SERVER=" & machName & "" & Chr(0)
       Attr = Attr & "DSN=" & catelog & Chr(0)
       Attr = Attr & "DESCRIPTION=DSN For HOSPITAL" & Chr(0)
       Attr = Attr & "DATABASE=HOSPITAL" & Chr(0)
       Attr = Attr & "TRUSTED_CONNECTION=YES" & Chr(0)
       iReturn = SQLConfigDataSource(0, 1, "SQL Server", Attr)
       If iReturn Then
           MsgBox("DSN setup complete successfully.", MsgBoxStyle.OKOnly + MsgBoxStyle.Information)
           MsgBox("DSN setup can not complete successfully.")
       End If

End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.