ASP中使用SQL SERVER做查询 请知道的人解释下····急在线等····

2024-11-09 05:16:01
推荐回答(2个)
回答1:

Set conn=Server.CreateObject("ADODB.Connection")
Connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.mappath("db_DangJian.mdb")
conn.Open connstr

sql = ""
set rs = conn.execute(sql)

回答2:

dim conn
Set conn = Server.Createobject("ADODB.Connection")
conn.Open "driver={SQL Server};server=服务器名;database=数据库名;uid=sa;pwd=密码"

sql = " select CustomerID,Password from M_PersonInfo "
Set rs=Server.Createobject("ADODB.Recordset")
rs.Open sql,conn,1,3
if rs.recordcount<>0 then
rs.movefirst
while not rs.bof and not rs.eof
response.write(rs("customerID"))
rs.movenext
wend
end if
rs.close
set rs =nothing
conn.close
set conn = nothing