ASP连接SQLSERVER2000问题我是新手都不懂
ASP连接SQLSERVER2000用ODBC连 怎么连啊 能告诉我个具体点的方法吗?一步一步的 那个代码什么的都看不懂呀 放到哪里也不知道啊.
谢谢各位高手啦
------解决方案--------------------sponse.Buffer = True
Dim IsSqlDataBase,ConnStr
IsSqlDataBase = 1
'定义数据库类别,1为SQL数据库,0为Access数据库
If IsSqlDataBase = 1 Then
'sql数据库连接参数:数据库名、用户密码、用户名、连接名(本地用local,外地用IP)
Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName
SqlDatabaseName = "zqbbs "
SqlPassword = "zqbbs "
SqlUsername = "zqbbs "
SqlLocalName = "(local) "
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & "; "
Else
'免费用户第一次使用请修改本处数据库地址并相应修改data目录中数据库名称,如将123.mdb修改为123.asp
Db = "data/123.mdb "
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db)
End If
On Error Resume Next
Set my_conn = Server.CreateObject( "ADODB.Connection ")
my_conn.open ConnStr
If Err Then
err.Clear
Setmy_conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。 " '注释,需要把这几个字翻译成英文。
Response.End
End If