在vb中如何运行sql命令如:update cwgl set jsr='llpp';

xxxuan 2001-12-18 04:20:18
在vb中如何运行sql命令如:
update cwgl set jsr='llpp';
...全文
67 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
westgirl 2001-12-18
  • 打赏
  • 举报
回复
在模块中:Public dars As New ADODB.Recordset 'ADO结果集
在过程中:

If dars.State = adStateOpen Then dars.Close
sql = "update da set 大类名称='" & Trim(TxtDa(0).Text) & "',大类目录='" & Trim(TxtDa(1).Text) & "' where 大类序号=" & CInt(Trim(Mid(TreeView1.SelectedItem.Key, 3, Len(TreeView1.SelectedItem.Key) - 2))) & ""
dars.Open sql, cn, adOpenKeyset, adLockBatchOptimistic
Ranma_True 2001-12-18
  • 打赏
  • 举报
回复
Dim tstrConn As String
Set PubConnect = New ADODB.Connection
tstrConn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=LSWaterData;Data Source=12.56.21.12;Network Library=DBMSSOCN"
PubConnect.Open tstrConn
Dim tobjRecord As Object
Set tobjRecord = CreateObject("Adodb.Recordset")
'------------
XtstrSql="update cwgl set jsr='llpp'"
tobjRecord.Open XtstrSql, PubConnect, adOpenKeyset, adLockOptimistic
Set GetRecord = tobjRecord
Set tobjRecord = Nothing
cherno 2001-12-18
  • 打赏
  • 举报
回复
dim adoCmd as adodb.command

set adoCmd=new adodb.command
adoCmd.activeconnextion=yourconnection
adoCmd.excute "Sql"

7,765

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧