Re: absolute newbie question - connecting to SQL server in ADO.net
From: SQL Cafe (support_at_sqlcafe.net)
Date: 03/09/04
- Next message: Pewak: "Dataview not in order after Sort"
- Previous message: SQL Cafe: "Re: how to update data from textboxes?"
- In reply to: Chris Strug: "absolute newbie question - connecting to SQL server in ADO.net"
- Messages sorted by: [ date ] [ thread ]
Date: 8 Mar 2004 23:31:44 -0800
"Chris Strug" <hotmail@solace1884.com> wrote in message news:<upirKOQBEHA.2888@TK2MSFTNGP09.phx.gbl>...
> 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.
Hello Chris,
You should try our data controls for use with vb.net and sqlserver.
You can create data access forms in minutes, and without writing much
code at all. All of the connection and control binding is done for
you. Our website is www.sqlcafe.net. You can also bind your database
columns to our data grid with no work at all. Please sign up for our
beta list and visit our discussion forum.
Thanks,
support@sqlcafe.net
- Next message: Pewak: "Dataview not in order after Sort"
- Previous message: SQL Cafe: "Re: how to update data from textboxes?"
- In reply to: Chris Strug: "absolute newbie question - connecting to SQL server in ADO.net"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|