
February 26th, 2004, 05:54 AM
|
|
Registered User
|
|
Join Date: Feb 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
connect SQL database to VB.net
Hye,
we're trying to connect a SQL database to a simple form in VB.net
We've tried the following code:
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim myDataGrid As DataGrid
myConnection = New SqlConnection("Server=(our server);uid="";pwd="";Database=our database")
myCommand = New SqlCommand("Select * FROM Relatie ", myConnection)
myConnection.open()
myDataGrid.DataSource = myCommand.ExecuteReader()
myDataGrid.DataBind() // -> gives fault, "not a member of System.Windows.Forms.Datagrid
myConnection.Close()
EndSub
Can someone plz help us with this?? Is it the correct way and where did we make our mistake??
Tkx
|