connstr="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("data.mdb")
Set conn=Server.CreateObject("Adodb.Connection")
conn.Open connstr
Set rs=server.Createobject("Adodb.recordset")
SQL="Select * From infor"
rs.open sql,conn,1,3
rs.delete
rs.update
rs.Close
Set rs=Nothing
conn.Close
Set conn=Nothing
connstr="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("data.mdb")
Set conn=Server.CreateObject("Adodb.Connection")
conn.Open connstr
SQL="Select * From infor where username='"& userName&"' " '搜索记录集
rs.open sql,conn,1,3
if not rs.eof then
rs.delete '执行删除
rs.update '可省略
else
response.write "数据库中没有你想要删除的数据"
end if
'方法二:用conn.execute
'sql="delete From infor where username='"& userName&"' "
'if no
'if not rs.eof then
'conn.execute(sql)
'else
'response.write "数据库中没有你想要删除的数据"
'end if
rs.Close
Set rs=Nothing
conn.Close
Set conn=Nothing
connstr="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("data.mdb")
Set conn=Server.CreateObject("Adodb.Connection")
conn.Open connstr
Set rs=Server.Createobject("Adodb.Recordset")
userName=Request.QueryString("txtUser")
SQL="Select * From infor where username='"& txtUser &"' "
rs.open sql,conn,1,3
rs.delete
rs.update
rs.Close
Set rs=Nothing
conn.Close
Set conn=Nothing
%>
是这样吗???
刚开始做ASP.. 还不太明白.
Dim userName
userName=request.QueryString("txtUser")
这段代码是不是返回值, 然后根据这个返回的值在数据库里进行选择删除啊???
connstr="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("data.mdb")
Set conn=Server.CreateObject("Adodb.Connection")
conn.Open connstr
Set rs=Server.Createobject("Adodb.Recordset")
id=Request.QueryString("txtID")
SQL="Delete From infor where id='"& id &"' "
conn.Execute(SQL)
rs.update
rs.Close
Set rs=Nothing
conn.Close
Set conn=Nothing