发布网友 发布时间:2022-04-25 06:16
共2个回答
热心网友 时间:2023-11-02 09:39
要写全部代码在这好象有点难,在此就给:如何和数据库联系起来
下面是能用的asp代码的一部分
<%
User = Request("User")
Pwd = Request("Pwd")
Page = Request("Page")
Set conn = Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("Data.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Select * From GuestBook Where Re = '0' Order By AddDate DESC", conn, 3
rs.Close
conn.Close
%>
热心网友 时间:2023-11-02 09:40
dim conn,db,connectstring
db="database\db1.mdb" '数据库文件相对于当前文件的路径
set conn=Server.CreateObject("ADODB.Connection")
connectstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.mappath(db) '连接字符串
conn.open connectstring
If Err.Number <> 0 Then
Err.Clear
Set conn = Nothing
response.Write "打开数据库时出现错误,请联系管理员..."
Response.Clear
Response.End
End If