How to connect to local database using ASP classic

2019-06-12 11:00发布

I have connected to my local database through SQLSMS using the string (LocalDb)\v11.0

It opened up a connection and I could add a database.

In my ASP classic code (don't ask :( C#.NET FTW!.. damn clients) I have the following code:

objConn.ConnectionString = "Provider=SQLOLEDB;Persist Security Info=True;Data Source=(LocalDb)\v11.0;Initial Catalog=databasename"

It is returning this error: Invalid authorization specification

I have no idea what to put in for the User Id and Password parameters?

2条回答
Root(大扎)
2楼-- · 2019-06-12 12:02

You'll need to use SQL server authentication for this:

objConn.ConnectionString = "User ID=<sql server user id>;Password=<password for sql server user>;Initial Catalog=<database>;Data Source=<database server\instance name>;Provider=SQLOLEDB"

Actually looks like there is a previous question 'SQL Server 2012 classic asp connection string' that might cover this in more detail.

查看更多
Fickle 薄情
3楼-- · 2019-06-12 12:06

Here's an example connection string (SQL Server 2014 on localhost):

cnstring = "Provider=SQLOLEDB.1;Data Source=.\sqlexpress;Initial Catalog=dATABASEnAME;UID=sqlsERVERUser;PWD=yourPassword;"
查看更多
登录 后发表回答