Re: absolute newbie question - connecting to SQL server in ADO.net

From: SQL Cafe (support_at_sqlcafe.net)
Date: 03/09/04


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



Relevant Pages

  • Re: Sql Server 2000 slow
    ... If I close the connection (moving the Open/Close ... ADO) and the dll gives twice the performance. ... > Are there any known performance issues with .NET accessing Sql Server ...
    (microsoft.public.dotnet.framework.performance)
  • Re: CoInitialize failure with many processes
    ... I could not find a good reference about ADO connection pooling, ... its own connection to the SQL Server. ... Regarding the Performance Monitor, I haven't seen anything out of the ...
    (microsoft.public.win32.programmer.ole)
  • Re: Cross Transactions between ADO & ADO.Net
    ... MARS session pool limited to one connection?). ... > There is one thing that might help here, if you're using SQL Server. ... We even call ADO code from ... >> the DTC cordinator from COM+ to handle the transactions between ADO.Net ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: SQL Server extremely slow
    ... my personal experience with a similar setup as your (Sql Server ODBC ... against the sql server (ADO was specifically designed for use with sql ... the connection is closed. ...
    (comp.databases.ms-access)
  • Re: SQL Server connection
    ... or sql server may accept only incoming connections ... What does it mean Connection Open? ... I usually, open my ADO ... > Is this the standard way to connect the ADOConnection, if it is not how do ...
    (borland.public.delphi.database.ado)