oledbConnection to SQL Server

Discussion in 'ASP .Net' started by Roger Withnell, Jul 12, 2008.

  1. I have built websites in Classic ASP and am now building my first one in
    ASP.NET.

    In Classic ASP, I connect to my SQL Server database with:

    Set ObjConn = Server.Createobject("ADODB.Connection")
    strConnection = "DSN=db1; database=db2;UID=xxx;PWD=yyy;"
    objConn.Open strConnection

    What is the connection string in asp.net?
    OleDbConnection("?")

    Any help much appreciated.

    Roger
     
    Roger Withnell, Jul 12, 2008
    #1
    1. Advertising

  2. I can now connect to the database on my operational server, which uses SQL
    Server authentication, with:

    'dbconn=New OleDbConnection("Provider=sqloledb; Data Source=ip address;
    Initial Catalog=dbName; User Id=xxxx; Password=yyyy;")

    But I cannot connect to my in house SQL Server on localhost, which uses
    Windows Authentication. The string:

    dbconn=New OleDbConnection("Provider=sqloledb; Data
    Source=UBE-IAS\SQLEXPRESS; Initial Catalog=upperbridge2; User Id=;
    Password=;")

    gives the error Invalid authorization specification.

    What is the correct connection string for this?

    Thanking you in anticipation.

    Roger



    "Mark Rae [MVP]" wrote:

    > "Roger Withnell" <> wrote in message
    > news:...
    >
    > > What is the connection string in asp.net?
    > > OleDbConnection("?")

    >
    > For ASP.NET you should use a native .NET data provider whenever possible:
    > http://www.connectionstrings.com/?carrier=sqlserver2005
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
    >
    >
     
    Roger Withnell, Jul 12, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vMike

    Re: ASP.NET and OleDbConnection

    vMike, Jun 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,328
    vMike
    Jun 24, 2003
  2. vMike

    Re: ASP.NET and OleDbConnection

    vMike, Jun 24, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,274
    rajeshseetharam
    Jun 6, 2005
  3. Roger Cantillo

    oleDBConnection not recognizing Database

    Roger Cantillo, Aug 28, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    3,040
    Kevin Spencer
    Aug 28, 2003
  4. Daniel Conlon

    OleDbConnection Security Exception

    Daniel Conlon, Oct 20, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    960
    Wim Hollebrandse
    Oct 20, 2003
  5. Keith
    Replies:
    1
    Views:
    471
    alex bowers
    Dec 11, 2003
Loading...

Share This Page