How to connect to local database using ASP classic :(

主宰稳场 提交于 2019-12-08 11:17:26

问题


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?


回答1:


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.




回答2:


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;"


来源:https://stackoverflow.com/questions/14833787/how-to-connect-to-local-database-using-asp-classic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!