asp vb 插入,更新,删除数据库操作。
记笔记。
离开学校,东西都还给老师了,哎。
Select Case str
Case "insert":
sql="select * from ["&tablename&"] where id=null"
rs.open sql,conn,1,3
rs.addnew
For Each key In request.Form
' response.write "rs("&CStr(key)&")="&request(key)&"<br>"
rs(CStr(key))=request(key)
Next
rs.update
rs.close
Case "update":
sql="select * from ["&tablename&"] where id="&id
rs.open sql,conn,1,3
For Each key In request.Form
if key<>"id" then
rs(CStr(key))=request(key)
end if
Next
rs.update
rs.close
Case "delete":
sql="delete from ["&tablename&"] where id in("&id&")"
rs.open sql,conn,1,3
Case ""
End Select