asp sql

asp sql

数据库不在乎大小写

删除:

<%
Dim number
number
=1
connstr
="driver={SQL Server};server=(local);uid=sa;pwd=1234;database=b2bb2b"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open connstr
conn.execute
"delete from buzaiyu_productshow where id>20131"
conn.close
Set rs=Nothing
Set conn=Nothing
response.write
"ok"
%>

循环查询插入:

<%
Dim i
i
=1
connstr
="driver={SQL Server};server=(local);uid=sa;pwd=1234;database=c2c"
Set conn = Server.CreateObject("ADODB.Connection")
conn.commandtimeout
=20
conn.open connstr
set rs=Server.CreateObject("ADODB.recordset")
Do While i<5
sql
="select * from buzaiyu_info where info_id='"&i&"'"
rs.open sql,conn,
1,1
conn.execute
"insert into buzaiyu_productshow(cpmc) values ('"&rs("showname")&"')"
response.write rs(
"info_id")
rs.close
i
=i+1
Loop
conn.close
Set rs=Nothing
Set conn=Nothing
response.write
"chenggong"
%>

插入:

<%
Dim string1
string1
="Öйú"
connstr
="driver={SQL Server};server=(local);uid=sa;pwd=1234;database=b2bb2b"
Set conn = Server.CreateObject("ADODB.Connection")
conn.commandtimeout
=20
conn.open connstr
conn.execute
"insert into buzaiyu_productshow(cpcd) values ('1123')"
response.write string1
%>

查询:

<%
connstr
="driver={SQL Server};server=(local);uid=sa;pwd=1234;database=b2bb2b"
Set conn = Server.CreateObject("ADODB.Connection")
conn.commandtimeout
=20
conn.open connstr
set rs=Server.CreateObject("ADODB.recordset")
sql
="select * from buzaiyu_productshow where id=102"
rs.open sql,conn,
1,1
string1
=rs("cpcd")
response.write string1
%>

posted @ 2011-06-09 21:11  wangkangluo1  阅读(438)  评论(0编辑  收藏  举报