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?
Éric MoreauConnect With a Mentor Senior .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
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:
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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.
É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.
All Courses

From novice to tech pro — start learning today.