ASP+ACCESS转换成ASP+SQL问题,请高手来帮忙!!

2024-12-26 14:24:56
推荐回答(5个)
回答1:

还有个Data Source你都没定义 也就是SQL服务器地址

另外ACC转SQL 不是简单改个数据库源就行的 程序中相应的代码甚至数据库中相应的字段都要做出合适的调整 这个就要具体情况具体分析了

你把
ConnStr = "Provider = Sqloledb; Persist Security Info=false; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & ";"

这句改成

ConnStr = "Provider = Sqloledb; Persist Security Info=false; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = (local);"

如果还不行 就要具体情况具体分析来改程序以及数据库了

回答2:

今天整理下以前连接过的库语句,分别如下:

ASP连接Excel语句

Dim Conn,Connstr
Connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=;Extended properties=Excel 5.0;Data Source="& Server.MapPath("db/goods.xls")
Set Conn = Server.CreateObject("ADODB.CONNECTION")
Conn.Open Connstr

ASP连接Access语句

dim conn,connstr
set conn=server.CreateObject("adodb.connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("database/# data.asp")
conn.open connstr

ASP连接Sql server语句

SQLServerName = "192.168.16.4" '服务器名称或地址,本机用(local)
SQLDBUserName = "sa" '数据库帐号
SQLDBPassword = "sa" '数据库密码
SQLDBName = "data" '数据库名称
'数据库连接
'On Error Resume Next '容错声明
response.buffer=true
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open"driver={SQL Server};server="&SQLServerName&";uid="&SQLDBUserName&";pwd="&SQLDBPassword&";database="&SQLDBName&""

回答3:

dim Conn,ConnStr

重复定义了

回答4:

连接字符串ConnStr不对

回答5:

哪个是31行啊。