ASP连接11种数据库语法总结(4)
发表于:2007-06-30来源:作者:点击数:
标签:
2.添加记录(Insert) 语法: Insert into table(field1,field2,....) Values (value1,value2,....) 例子:添加一作者是"cancer"的记录入book表: insert into book (bookno,author,bookname) values (’CF001’,’cancer’,’Cancer无组件上传程序’) 同样,如
2.添加记录(Insert)
语法:
Insert into table(field1,field2,....) Values (value1,value2,....)
例子:添加一作者是"cancer"的记录入book表:
insert into book (bookno,author,bookname) values (’CF001’,’cancer’,’Cancer无组件上传程序’)
同样,如果用到变量就如下:
strno=request.form("bookno")
strau=request.form("author")
strname=request.form("bookname")
str
sql="insert into book (bookno,author,bookname) values (’"&strno&"’,’"&strau&"’,’"&strname&"’)"
3.用Recordset对象的Addnew插入数据的方法:
语法:
rs.addnew
rs("field1").value=value1
rs("field2").value=value2
...
rs.update
4.修改数据记录(Update)
语法:
update table set field1=value1,field2=value2,...where fieldx=valuex
例子:
update book set author=’babycrazy’ where bookno=’CF001’
如果用到变量就如下:
strno=request.form("bookno")
strau=request.form("author")
strsql="update book set author=’"&strau&"’ where bookno=’"&strno"’"
原文转自:http://www.ltesting.net