数据库追加数据update
Private Sub Cmdbc_Click()
mlink = "provider=microsoft.jet.oledb.3.51; persist security info= false; "
mlink = mlink + "data source=生产成本.mdb "
Adodc2.ConnectionString = mlink
Adodc2.CommandType = adCmdUnknown
Dim sql As String
Dim bn As String
sql = "update 1车间(A产品) set 日期= '2007-12-12 ',摘要= '余额 ',发生额=Val(Text6) "
Adodc1.Recordset.ActiveConnection.Execute sql
'bn = "insert 1车间(A产品) values( '2007/12/7 ', '余额 ' ', 'Val(Text6) ' ) "
'Adodc1.Recordset.ActiveConnection.Execute bn
End Sub
向access数据库中添加时vb提示update语句的语法错误
用insert时提示insert语句错误给纠正一下
[解决办法]
sql = "update 1车间(A产品) set 日期= '2007-12-12 ',摘要= '余额 ',发生额=Val(Text6) "
改为
sql = "update 1车间(A产品) set 日期= '2007-12-12 ',摘要= '余额 ',发生额= " & Val(Text6)
试验一下
[解决办法]
sql = "update [1车间(A产品)] set 日期=#2007-12-12#,摘要= '余额 ',发生额= " & Val(Text6) & "
[解决办法]
如果不行这句再改
sql = "update [1车间](A产品) set 日期= '2007-12-12 ',摘要= '余额 ',发生额= ' " & Val(Text6) & " ' "
再不行那是不是
Adodc2.ConnectionString = mlink '为什么这里是adodc2
Adodc2.CommandType = adCmdUnknown
Dim sql As String
Dim bn As String
sql = "update 1车间(A产品) set 日期= '2007-12-12 ',摘要= '余额 ',发生额=Val(Text6) "
Adodc1.Recordset.ActiveConnection.Execute sql '为什么这里又是adodc1