mahesh_575
Mar 24th, 2004, 06:06 AM
Hello
I have written following code for getting connectivity with SQL Server. DB server is on separate pc. I am giving its IP address in connection string.
Dim myConnectionString As String = "Provider=SQLOLEDB; Data Source=IP Addr of db server; Initial Catalog=DB Name; User Id=UserName; Password=Password;"
Dim myConnection As New SqlConnection(myConnectionString)
myConnection.Open()
Dim myReadQuery As String = "select * from dbAkitaAdmin"
Dim myCommand As New SqlCommand(myReadQuery)
Dim adapter As New SqlDataAdapter()
Dim myDataSet as New DataSet()
adapter.SelectCommand = myCommand
adapter.Fill(myDataSet)
But it is giving me error as follows
Compiler Error Message: BC30002: Type 'SqlConnection' is not defined.
Pls suggest the way for this connectivity.
Also pls kindly expln about usage of SqlCommand, SqlDataAdapter and SqlDataReader classes.
Thanks
Mahesh
I have written following code for getting connectivity with SQL Server. DB server is on separate pc. I am giving its IP address in connection string.
Dim myConnectionString As String = "Provider=SQLOLEDB; Data Source=IP Addr of db server; Initial Catalog=DB Name; User Id=UserName; Password=Password;"
Dim myConnection As New SqlConnection(myConnectionString)
myConnection.Open()
Dim myReadQuery As String = "select * from dbAkitaAdmin"
Dim myCommand As New SqlCommand(myReadQuery)
Dim adapter As New SqlDataAdapter()
Dim myDataSet as New DataSet()
adapter.SelectCommand = myCommand
adapter.Fill(myDataSet)
But it is giving me error as follows
Compiler Error Message: BC30002: Type 'SqlConnection' is not defined.
Pls suggest the way for this connectivity.
Also pls kindly expln about usage of SqlCommand, SqlDataAdapter and SqlDataReader classes.
Thanks
Mahesh