ASP与MySQL数据处理

首先连接数据库,方法:http://www.xefan.com/archives/66045.html。以下语句为示例语句,请根据实际情况修改
查询数据:

Set RS = conn.Execute(“SELECT * FROM user”)
While Not RS.EOF ‘while…wend循环,用于读取所有的信息
Response.Write RS.Fields(“username”) & “, “ & RS.Fields(“password”) & “<br>”
RS.MoveNext ‘记录集指针下移
Wend

插入数据:

Set rs = Conn.Execute(“insert into user (nm,pw) values (test’,’test’)”)

更新数据:

Set rs = Conn.Execute(“update user set nm=’用户ASPupdate’,pw=’pwaspupdate’ where id=24”)

删除数据:

Set rs = Conn.Execute(“delete from user where id=25”)