Hi,
I am a new user of VB.net. Could you tell me how to connect Vb.net to sql 2000 server?
Many Thanks
:rolleyes:
Printable View
Hi,
I am a new user of VB.net. Could you tell me how to connect Vb.net to sql 2000 server?
Many Thanks
:rolleyes:
Hi,
Programmatically, use connectionstring as in the VB6 but dotnet use dataadapter for that purpose.
Another one is the "Drag and Drop" the connection to your form and give some setting.
Hi,
The suitable connectionstring can be found here :
http://www.able-consulting.com/ado_c...f=ado_conn.htm
You have several way of doing this. I obtains lists of servers, databases and tables with SQLDMO like this:
Private serverobj As SQLDMO.SQLServer
Private conn As SqlClient.SqlConnection
Private adapter As SqlClient.SqlDataAdapter
Private server As String
Private database As String
Public Function GetServers() As ArrayList
Dim servers As ArrayList
Dim i As Integer
Dim applicatie As SQLDMO.Application
Dim lijst As SQLDMO.NameList
servers = New ArrayList
applicatie = New SQLDMO.Application
lijst = applicatie.ListAvailableSQLServers
For i = 1 To lijst.Count
servers.Add(lijst.Item(i))
'MsgBox(lijst.Item(i))
Next
Return servers
End Function
Public Function GetDatabases() As ArrayList
Dim databases As ArrayList
If MakeConnection() Then
Dim db As SQLDMO.Database
databases = New ArrayList
For Each db In serverobj.Databases
databases.Add(db.Name)
Next
Else
Return Nothing
End If
Return databases
End Function
Private Function MaakConnectie() As Boolean
On Error GoTo errorhandler
'Maak verbinding met server
serverobj = New SQLDMO.SQLServer
serverobj.LoginSecure = True
serverobj.Connect(server)
Return True
end function
And making updates, I do with objects from the SQLClient namespace