📄 调用ado的updatebatch出错.txt
字号:
对 存 取 的 表 设 置 主 关 键 字 可 解 决 问 题 。
<END>
为 什 么 要 用 ADODC控 件 呢 ?
下 面 给 出 执 行 速 度 更 快 的 编 写 方 法 >>用 代 码 编 程
引 用 :Microsoft ActiveX Data Object 2.0 Library
dim db as new adodb.connection
dim rs as new adodb.recordset
'针 对 ACCESS的 连 接 方 法
db.open "Provider=Microsfot.olddb.jet.3.51;data source=*.mdb;"
'针 对 SQL Server 的 连 接 方 法
db.open "DSN=ODBC名 ;UID=用 户 名 ;PWD=口 令 ;"
rs.open SQL 语 句 ,db,adopenkeyset,adlockoptimistic
以 "SELECT 姓 名 ,年 龄 ,级 别 FROM YGDA where 姓 名 ='AAA'"
其 中 :txtName>>姓 名 ,txtAge>>年 龄 ,TxtClass>>级 别 为 例
Source Code:
rs.open "SELECT 姓 名 ,年 龄 ,级 别 FROM YGDA where 姓 名 ='" & txtName.text &"'",db,3,3
新 增 :
if rs.recordsetcount=0 then
rs.Addnew
rs!姓 名 =txtname.text
rs!年 龄 =txtage.text
rs!级 别 =txtClass.text
rs.Update
end if
rs.close
编 辑 :
if rs.recordsetcount>0 then
rs!姓 名 =txtname.text
rs!年 龄 =txtage.text
rs!级 别 =txtClass.text
rs.Update
end if
rs.close
删 除 :db.execute "Delete YGDA where 姓 名 ='" & txtName.text &"'"
<END>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -