asp如何连接 access数据库,并把表 content,字段为 标题,为空的内容 删除。怎么写代码呀
asp如何连接access数据库,并把表content,字段为标题,为空的内容删除。怎么写代码呀...
asp如何连接 access数据库,并把表 content,字段为 标题,为空的内容 删除。怎么写代码呀
展开
1个回答
展开全部
dim db
db = “数据库路径”
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
on error resume next
conn.open connstr
if err then
Err.Clear
Call CloseConn()
Response.Write "数据库连接出错,请打开conn.asp文件检查连接字串。"
Response.End
end if
Function CloseConn()
conn.close
set conn=nothing
End Function
Dim FoundErr,ErrMsg
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select * from content where title=null "
rs.open sql,conn,1,3
rs.delete;
rs.update
set rs=Nothing
db = “数据库路径”
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
on error resume next
conn.open connstr
if err then
Err.Clear
Call CloseConn()
Response.Write "数据库连接出错,请打开conn.asp文件检查连接字串。"
Response.End
end if
Function CloseConn()
conn.close
set conn=nothing
End Function
Dim FoundErr,ErrMsg
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select * from content where title=null "
rs.open sql,conn,1,3
rs.delete;
rs.update
set rs=Nothing
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询