就下面几句代码,一运行就出错,提示“关闭对象时,不允许操作”,我并没有关闭对象啊,在这之前也没有其它的代码,对于这个错误我感到很奇怪,哪位帮帮忙看看是怎么回事啊,先谢谢了!
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db.mdb;Persist Security Info=False"
Adodc1.RecordSource = "update member set m_money='1' where m_name='张三'"
Adodc1.Refresh
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db.mdb;Persist Security Info=False"
Adodc1.RecordSource = "update member set m_money='1' where m_name='张三'"
Adodc1.Refresh
解决方案 »
- 如何用Excel的VBA切换到CAD程序?模拟ALT+TAB功能.
- VB中怎么动态创建access数据库以及数据库表
- 在vb中取得access的所有表名.该怎么取,
- 如何读取TXT文件中的内容
- I服了VB,VB中的Set和New是怎么用的????????
- 在三层结构中,中间层放在独立的server上,如何用com+和进行server进行通信呢?
- 请再给点指点 在线等待
- 请各位高手指教:如何用API播放指定的声音文件?
- 我想把vb程序中的option的值和access连接起来,怎么连接呀?我刚刚学vb,不会编,可是老板追的急,那位帮我解决一下呀
- to:SJSOFT你这混蛋,我杀了你!!!
- 窗口初始化的问题
- 我用VB写的邮件接受系统为什么不能接受附件啊??
adodc1.Open
Adodc1.RecordSource = "select * from member "Adodc1.Refresh
End SubPrivate Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db.mdb;Persist Security Info=False"
Adodc1.RecordSource = "update member set m_money='1' where m_name='张三'"
End Sub
请各位给出完整的代码,我觉得就是连接数据,然后写sql语句,最后执行,就这三步啊,怎么在我的上面就不能运行?其它的还要做什么??
这是测试过的
你修改数据,不能做记录集,reflesh会出问题
所以给你加了
Adodc1.RecordSource = "select * from member "其实这种处理方式不好
http://www.symental.com/sfw?f=testdb另外我用select语句可以达到这个效果,代码如下:
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from member where m_name='张三'"
Adodc1.Refresh
Adodc1.Recordset("m_money") = "qqqqqqqq"
Adodc1.Recordset.Update
但是我想知道update语句在Adobe中到底该怎样用,我觉得update才是一步到位的,它不是sql的标准语句吗?
Private Sub s_save()
Dim con As New Connection
Dim strS As String
con.CursorLocation = adUseClient
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db.mdb;Persist Security Info=False"
strS = "update member set m_money='1' where m_name='张三'"
con.BeginTrans
con.Execute strS, con, adOpenStatic, adLockOptimistic
con.CommitTrans
con.Close
Set con = Nothing
Exit Sub
ERRS:
MsgBox Err.Number & ", " & Err.Description, vbOKOnly + vbExclamation, "SAVE"
con.RollbackTrans
con.Close
Set con = Nothing
End Sub