This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C3E0FC.F1C1DBA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello I am trying to access my data using some of the examples on the VB =
Resource CD to learn about VB.net. I have used the following code:
Public Sub InsertRow(ByVal myConnectionString As String)
MyConnectionString =3D "database=3DNorthwind;Server=3Dlocalhost"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As =
System.EventArgs) Handles Button2.Click
Dim myConnection As New SqlConnection
Dim myInsertQuery As String =3D "INSERT INTO Customers (CustomerID, =
CompanyName) Values('NWIND', 'Northwind Traders')"
Dim myCommand As New SqlCommand(myInsertQuery)
myCommand.Connection =3D myConnection
myConnection.Open()
myCommand.ExecuteNonQuery()
myCommand.Connection.Close()
End Sub 'SelectSqlClientSrvRows
When I click f5 and run the app, I get no compile errors. When I click =
on the button, however and attempt to access the server, I get the =
following error:
An unhandled exception of type 'System.InvalidOperationException' =
occurred in system.data.dll
Additional information: The ConnectionString property has not been =
initialized.
Additional information is as follows:
1. I have Visual Studio.net installed with MSDE on my computer. In my =
server explorer I have the following items showing.=20
SQL Servers ---GARYLAP\INSTANCE--------
2. Under the GARYLAP\INSTANCE I have the following databases:
Master
Model
MSDB
Northwind
I have modified the connection string until I finally gave up. I tried =
server =3Dgarylap and garylap\instance but to no avail. Any help would =
be greatly appreciated. =20
Thanks,
Gary
------=_NextPart_000_0008_01C3E0FC.F1C1DBA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hello I am trying to access my data =
using some of=20
the examples on the VB Resource CD to learn about VB.net. I have =
used the=20
following code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Public Sub InsertRow(ByVal =
myConnectionString As=20
String)<BR>MyConnectionString =3D =
"database=3DNorthwind;Server=3Dlocalhost"<BR>End=20
Sub<BR>Private Sub Button2_Click(ByVal sender As System.Object, ByVal e =
As=20
System.EventArgs) Handles Button2.Click<BR>Dim myConnection As New=20
SqlConnection<BR>Dim myInsertQuery As String =3D "INSERT INTO Customers=20
(CustomerID, CompanyName) Values('NWIND', 'Northwind Traders')"<BR>Dim =
myCommand=20
As New SqlCommand(myInsertQuery)<BR>myCommand.Connection =3D=20
myConnection<BR>myConnection.Open()<BR>myCommand.ExecuteNonQuery()<BR>myC=
ommand.Connection.Close()<BR>End=20
Sub 'SelectSqlClientSrvRows</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>When I click f5 and run the app, I get =
no compile=20
errors. When I click on the button, however and attempt to access =
the=20
server, I get the following error:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>An unhandled exception of type=20
'System.InvalidOperationException' occurred in =
system.data.dll</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Additional information: The =
ConnectionString=20
property has not been initialized.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Additional information is as =
follows:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>1. I have Visual =
Studio.net=20
installed with MSDE on my computer. In my server explorer I have =
the=20
following items showing. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>SQL Servers =20
---GARYLAP\INSTANCE--------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>2. Under the=20
GARYLAP\INSTANCE I have the following databases:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Master</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Model</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>MSDB</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Northwind</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have modified the connection string =
until I=20
finally gave up. I tried server =3Dgarylap and garylap\instance =
but to no=20
avail. Any help would be greatly appreciated. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Gary</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0008_01C3E0FC.F1C1DBA0--