ASP问题 高手来
来源:百度知道 编辑:UC知道 时间:2024/06/11 17:01:03
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_pad_STRING
Recordset1.Source = "SELECT * FROM pad ORDER BY id DESC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
这是我网页的一串代码,Recordset1.ActiveConnection = MM_pad_STRING 这段代码在空间上提示错误:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/Index.asp, line 130
130行就是提示出错的代码。
请问怎么改正,越详细越好。本人菜鸟,好回答可追加,紧急
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_pad_STRING
Recordset1.Source = "SELECT * FROM pad ORDER BY id DESC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
这是我网页的一串代码,Recordset1.ActiveConnection = MM_pad_STRING 这段代码在空间上提示错误:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/Index.asp, line 130
130行就是提示出错的代码。
请问怎么改正,越详细越好。本人菜鸟,好回答可追加,紧急
链接一个绝对路径
这种连接方式除非是自己的服务器,否则是连接不上的。换用字符串连接
你看看你有连接数据库的文件没,问题应该在连接数据库文件上
set conn=Server.Createobject("adodb.connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("yy.mdb")
set rs = Server.CreateObject("ADODB.Recordset")
rs.open "SELECT * FROM pad ORDER BY id DESC" ,conn,1,3
这种方式连连
Dim Conn,ConnStr
Const Db="data/test.mdb"
Connstr="Provider=Microsoft.Jet.OleDb.4.0;Data Source="&Server.Mappath(Db)
Set Conn = Server.Createobject("adodb.connection")
Conn.open ConnStr
If Err Then
Err.Clear
Conn.Close:Set Conn=Nothing
Response.Write "数据库连接出错"
Response.End()
End If
set rs = Server.CreateObject("ADODB.Recordset")
rs.open "SELECT * FROM pad ORDER BY id DESC" ,conn,1,3