C
Chris Strug
Hi,
I have previously worked with Access 2000 and SQL server 2000 and I am
comfortable using ADO in this way.
In a (probably vain) attempt to take things further I bought a copy of
VB.net standard edition with an eye to writing stand-alone applications with
SQL server 2000 in stead of using Access using (I assume) ADO.net
Having installed VB.net I've created a simple windows application and in the
code to the initial form load I have tried to create a simple connection to
an SQL server.
And I'm stuck.
This is the code that I am attempting to use in the load event of the
default form.
Dim conn As ADODB.Connection
conn = New ADODB.Connection
conn.Open("Provider=MSDataShape.1;Persist Security Info=False;Data
Source=TLC01;Integrated Security=SSPI;Initial Catalog=ConControl2;Data
Provider=SQLOLEDB.1")
conn.Open()
In running this I get the error:
"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in
WindowsApplication2.exe
Additional information: Operation is not allowed when the object is open."
I have referenced "Microsoft ActiveX Data Objects 2.7 Library". Other than
that I'm not really sure what to do.
I have three questions:
1. Am I (trying to) using ADO or ADO.net in this example?
2. How do I get the above connection working? I assume that I'm missing some
vital aspect of the connection but I don't know what it is. As I said, my
experience of ADO prior to this was in Access 2000.
3. Have I wasted my money buying VB.net standard because it can't connect to
an SQL server 2000 server?
My apologies if these questions are somewhat banal but in my defence we all
have to start somewhere.
Any advice, links or otherwise are gratefully recieved..
Kind regards
Chris.
I have previously worked with Access 2000 and SQL server 2000 and I am
comfortable using ADO in this way.
In a (probably vain) attempt to take things further I bought a copy of
VB.net standard edition with an eye to writing stand-alone applications with
SQL server 2000 in stead of using Access using (I assume) ADO.net
Having installed VB.net I've created a simple windows application and in the
code to the initial form load I have tried to create a simple connection to
an SQL server.
And I'm stuck.
This is the code that I am attempting to use in the load event of the
default form.
Dim conn As ADODB.Connection
conn = New ADODB.Connection
conn.Open("Provider=MSDataShape.1;Persist Security Info=False;Data
Source=TLC01;Integrated Security=SSPI;Initial Catalog=ConControl2;Data
Provider=SQLOLEDB.1")
conn.Open()
In running this I get the error:
"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in
WindowsApplication2.exe
Additional information: Operation is not allowed when the object is open."
I have referenced "Microsoft ActiveX Data Objects 2.7 Library". Other than
that I'm not really sure what to do.
I have three questions:
1. Am I (trying to) using ADO or ADO.net in this example?
2. How do I get the above connection working? I assume that I'm missing some
vital aspect of the connection but I don't know what it is. As I said, my
experience of ADO prior to this was in Access 2000.
3. Have I wasted my money buying VB.net standard because it can't connect to
an SQL server 2000 server?
My apologies if these questions are somewhat banal but in my defence we all
have to start somewhere.
Any advice, links or otherwise are gratefully recieved..
Kind regards
Chris.