asp conn.execute调用access后台查询

1.
rs.open sql,conn,a,b,c
2.
conn.execute(sql,rowsaffected,c)
参数含义:
sql的值可以是sql语句、表名、存储过程名,也可以是数据提供者所能接受的任意字符串。为了提高性能,最好为c参数指定合适的值
可选参数rowsaffected将返回insert、update或delete查询执行以后所影响的数目。这些查询会返回一个关闭的recordset对象。

 

a:
adopenforwardonly(=0)
只读,且当前数据记录只能向下移动


 


adopenkeyset(=1)
只读,当前数据记录可自由移动


 


adopendynamic(=2)
可读写,当前数据记录可自由移动


 


adopenstatic(=3)
可读写,当前数据记录可自由移动,可看到新增记录


 


b:


 


adlockreadonly(=1)
缺省锁定类型,记录集是只读的,不能修改记录


 


adlockpessimistic(=2)
悲观锁定,当修改记录时,数据提供者将尝试锁定记录以确保成功地编辑记录。只要编辑一开始,则立即锁住记录。


 


adlockoptimistic(=3)
乐观锁定 ,直到用update方法提交更新记录时才锁定记录。


 


adlockbatchoptimistic(=4)
批量乐观锁定,允许修改多个记录,只有调用updatebatch方法后才锁定记录。


 


当不需要改动任何记录时,应该使用只读的记录集,这样提供者不用做任何检测。
对于一般的使用,乐观的锁定可能是最好的选择,因为记录只被锁定一小段时间,
数据在这段时间被更新。这减少了资源的使用。


 


c:(指定sql语句类型)
adcmdunknown (= &h0008)
未知,需要系统来判断,速度慢,为缺省值


 


adcmdtext (= &h0001)
命令语句如sql语句
如:select * from table1


 


adcmdtable (= &h0002)
查询的表名称,例如:table1


 


adcmdstoredproc (= &h0004)
存储过程名称


 


adcmdfile (= &h0100)
对象类型相应的文件名称


 


adcmdtabledirect (= &h0200)
是能直接从表中获取行内容的表名称

 

 

其中:

CommandTypeEnum Values

ConstantValueDescription
adCmdUnspecified-1Does not specify the command type argument.
adCmdText1Evaluates CommandText as a textual definition of a command or stored procedure call.
adCmdTable2Evaluates CommandText as a table name whose columns are all returned by an internally generated SQL query.
adCmdStoredProc4Evaluates CommandText as a stored procedure name.
adCmdUnknown8Indicates that the type of command in the CommandText property is not known.
adCmdFile256Evaluates CommandText as the file name of a persistently stored Recordset. Used with Recordset.Open or Requery only.
adCmdTableDirect512Evaluates CommandText as a table name whose columns are all returned. Used with Recordset.Open or Requery only. To use the Seek method, the Recordset must be opened with adCmdTableDirect. This value cannot be combined with the ExecuteOptionEnum value adAsyncExecute.

 

 

==================

http://www.dnbcw.com/biancheng/asp/BMAW5248.html

http://www.w3schools.com/ado/met_conn_execute.asp

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值