INSERT INTO 语句的语法错误? 5
DBConnection.ConnectionString=DB_CnStr()DBConnection.Open()DimsqlAsNewSystem.Text.Str...
DBConnection.ConnectionString = DB_CnStr()
DBConnection.Open()
Dim sql As New System.Text.StringBuilder
sql.Append("INSERT INTO [能量赋值_气源数据] ([日期],[CH4],[N2],[CO2],[C2H6],[C3H8],[H20],[H2S],[H2],[CO],[O2],[iC4H10],[nC4H10],[iC5H12],[nC5H12],[nC6H14],[nC7H16],[nC8H18],[nC9H20],[nC10H22],[He],[Ar],[温度],[压力],[站场名称],[流量],[测量热量],[记录人],[备忘信息])VALUES('" & _Date & "'," & _CH4 & "," & _N2 & "," & _CO2 & "," & _C2H6 & "," & _C3H8 & "," & _H20 & "," & _H2S & "," & _H2 & "," & _CO & "," & _O2 & "," & _iC4H10 & ", " & _nC4H10 & "," & _iC5H12 & "," & _nC5H12 & "," & _nC6H14 & "," & _nC7H16 & "," & _nC8H18 & ", " & _nC9H20 & "," & _nC10H22 & "," & _He & "," & _Ar & "," & _T & "," & _P & ",'" & _ZC & "'," & _Q & "," & _CHeat & ",'" & _UName & "','" & _BZ & "')")
Dim cmd As New OleDb.OleDbCommand(sql.ToString, DBConnection)
cmd.ExecuteNonQuery()-----------------------------这句报错INSERT INTO 语句的语法错误
DBConnection.Close()
End Function
Public Function DB_CnStr() As String
Return "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\data\GEMS.mdb;Jet OLEDB:Database Password=gasenergy"
End Function
Private Sub 气源信息录入_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
DateTimePicker1.CustomFormat = "yyyy-MM-dd hh:ss"
DateTimePicker1.Format = DateTimePickerFormat.Custom
End Sub 展开
DBConnection.Open()
Dim sql As New System.Text.StringBuilder
sql.Append("INSERT INTO [能量赋值_气源数据] ([日期],[CH4],[N2],[CO2],[C2H6],[C3H8],[H20],[H2S],[H2],[CO],[O2],[iC4H10],[nC4H10],[iC5H12],[nC5H12],[nC6H14],[nC7H16],[nC8H18],[nC9H20],[nC10H22],[He],[Ar],[温度],[压力],[站场名称],[流量],[测量热量],[记录人],[备忘信息])VALUES('" & _Date & "'," & _CH4 & "," & _N2 & "," & _CO2 & "," & _C2H6 & "," & _C3H8 & "," & _H20 & "," & _H2S & "," & _H2 & "," & _CO & "," & _O2 & "," & _iC4H10 & ", " & _nC4H10 & "," & _iC5H12 & "," & _nC5H12 & "," & _nC6H14 & "," & _nC7H16 & "," & _nC8H18 & ", " & _nC9H20 & "," & _nC10H22 & "," & _He & "," & _Ar & "," & _T & "," & _P & ",'" & _ZC & "'," & _Q & "," & _CHeat & ",'" & _UName & "','" & _BZ & "')")
Dim cmd As New OleDb.OleDbCommand(sql.ToString, DBConnection)
cmd.ExecuteNonQuery()-----------------------------这句报错INSERT INTO 语句的语法错误
DBConnection.Close()
End Function
Public Function DB_CnStr() As String
Return "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\data\GEMS.mdb;Jet OLEDB:Database Password=gasenergy"
End Function
Private Sub 气源信息录入_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
DateTimePicker1.CustomFormat = "yyyy-MM-dd hh:ss"
DateTimePicker1.Format = DateTimePickerFormat.Custom
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询