在VB中用insert into语句加入一条记录,显示insert into语法错误
数据库为q.mdb;表为wenduzhi;我想插入日期、以及datatemp(num)中的数据,Ifdatatemp(num)<>0ThenDimCnnAsNewADOD...
数据库为q.mdb;表为wenduzhi;我想插入日期、以及datatemp(num)中的数据,
If datatemp(num) <> 0 Then
Dim Cnn As New ADODB.Connection
Cnn.Open "provider=microsoft.jet.oledb.4.0;Data source=" & App.Path & "\q.mdb;persist security info=false"
Cnn.Execute ("insert into wenduzhi(time,wendu) values('" & Str(Now) & "','" & datatemp(num) & "')")
Adodc1.Refresh '调用报警过程
num = num + 1 '采集个数
If num > 99 Then Call renew '采集个数大于200刷新
End If
End Sub
当我只用
Cnn.Execute ("insert into wenduzhi(time,wendu) values('" & datatem(num) & "')")或者Cnn.Execute ("insert into wenduzhi(time,wendu) values('" & Str(Now) )")
时都正确,但想同时添加两个字段就不行,急求!!!请你帮助我谢谢 展开
If datatemp(num) <> 0 Then
Dim Cnn As New ADODB.Connection
Cnn.Open "provider=microsoft.jet.oledb.4.0;Data source=" & App.Path & "\q.mdb;persist security info=false"
Cnn.Execute ("insert into wenduzhi(time,wendu) values('" & Str(Now) & "','" & datatemp(num) & "')")
Adodc1.Refresh '调用报警过程
num = num + 1 '采集个数
If num > 99 Then Call renew '采集个数大于200刷新
End If
End Sub
当我只用
Cnn.Execute ("insert into wenduzhi(time,wendu) values('" & datatem(num) & "')")或者Cnn.Execute ("insert into wenduzhi(time,wendu) values('" & Str(Now) )")
时都正确,但想同时添加两个字段就不行,急求!!!请你帮助我谢谢 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询