首页
印 像 新 闻 系 统
网站首页 公告信息 编程实例 PHP函数 摄影无界 全景展示 我的作品 意见专栏
 

ASP中常用的SQL命令

【2006年01月20日 13:51:18】 【阅读:次】 【字体:大 中 小 默认】 【背景:#换背景 #换背景 #换背景 #换背景 #换背景 #换背景 #换背景 默认】

数据库连接(access)

db="data.mdb"
connstr = "provider=microsoft.jet.oledb.4.0;data source="&Server.Mappath(db)&""   
set conn=server.createobject("ADODB.CONNECTION")

conn.open connstr

删除记录:

conn.execute "delete * from [user] where [yl_id]="&clng(ID)

更改记录内容:

 sql="Select * from [user] where id="&id&""
Set rs=Server.CreateObject("Adodb.RecordSet")
 rsreg.Open sql,conn,1,3
 if not (rsreg.bof and rsreg.EOF) then
 rs("youbian")=115000
 rs.update
 end if

 

conn.execute("update [user] set [youbian]=115000 where [id]="&id&"")

记录添加

set rs=server.CreateObject("adodb.recordset")
       sql="select * from [user] where [youbian]="&youbian&""
       rs.open sql , conn,1,3
      if not (rs.eof and rs.bof) then
   response.write "该记录已存在"
      response.end
    else
             rs.addnew
    rs("youbian")=youbian
       rs.update
   end if

 

conn.execute "insert into [user] (name,youbian) values ("&name&","&youbian&")"


(『印像空间』 【本文来源:『学习笔记』】 【作者:未知】 【录入:留印】)
限200字,剩余 字
关 键 字:
    
搜索条件: