Skip to content

Create dsn runtime for sql server in vb.net

vipin paliwal

Asked May 14, 2006, 3:27 AM EDT1 answer
Share
LinkedInX
hi all,
i want to create dsn runtime for sql server in vb.net, pls help with code.
thanks

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi Vipin, Use the following code to create a DSN at runtime: Dim str As String Dim ServerName As String = "YourServerName" Dim DatabaseName As String = "YourDBName" str = "SERVER=" & ServerName & "" & Chr(0) str = Attr & "DSN=" & DatabaseName & Chr(0) str = Attr & "DESCRIPTION=TestDSN" & Chr(0) str = Attr & "DATABASE=Test" & Chr(0) str = Attr & "TRUSTED_CONNECTION=No" & Chr(0) SQLConfigDataSource(0, 1, "SQL Server", str ) Take care, Arun
    0