W
Woody Splawn
In the course of using VS.net I have generally setup my connections by
dragging a SQLDataAdatper to the form and going from there. However, I am
at a point where I would like to begin connecting to the database and
creating DataAdapters and DataSets via code.
On a form I go into the ConnectionString property of a SQLConnection object
and copy the values there. I suppose that I can just copy these values to
my connection string that I create in code, but I can not. I have code that
looks like this:
Dim myConnection As New SqlClient.SqlConnection
myConnection = New SqlConnection
Try
'myConnection = "workstation id=P426;packet size=4096;integrated
security=SSPI;data source=P426;persist security info=False;initial
catalog=Corp"
Catch ex As Exception
End Try
With the code above I get a squiggly under the "Workstation id = P426...."
line and it says, "Value of Type String can not be converted to
System.data.sql.connection"
What do I need to do to write a connection string that is palatable to my
code? What is the easiest way of doing this?
dragging a SQLDataAdatper to the form and going from there. However, I am
at a point where I would like to begin connecting to the database and
creating DataAdapters and DataSets via code.
On a form I go into the ConnectionString property of a SQLConnection object
and copy the values there. I suppose that I can just copy these values to
my connection string that I create in code, but I can not. I have code that
looks like this:
Dim myConnection As New SqlClient.SqlConnection
myConnection = New SqlConnection
Try
'myConnection = "workstation id=P426;packet size=4096;integrated
security=SSPI;data source=P426;persist security info=False;initial
catalog=Corp"
Catch ex As Exception
End Try
With the code above I get a squiggly under the "Workstation id = P426...."
line and it says, "Value of Type String can not be converted to
System.data.sql.connection"
What do I need to do to write a connection string that is palatable to my
code? What is the easiest way of doing this?