oledbConnection to SQL Server

  • Thread starter Thread starter Roger Withnell
  • Start date Start date
R

Roger Withnell

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
 
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
 
Back
Top