大家来关注下这个问题....谢谢啦~~~~~~~~~~~~ Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button2.Click Dim oledbCnstr As String Dim oledbDate As New DataSet oledbCnstr = provider=microsoft.jet.oledb.4.0;data source=Books.mdb Dim oledbCn As OleDbConnection oledbCn = New OleDbConnection(oledbCnstr) Dim oledb
sql,oledbDel,oledbIns,oledbUpdate As String Dim oledbAdpter As OleDbDataAdapter oledbAdpter = New OleDbDataAdapter oledbCn.Open() Try oledbIns = insert into borrow (BorrowNo,CardNo,BorrowDate)values ( j001,k002,1987-01-02 ) oledbAdpter.InsertCommand = New OleDbCommand(oledbIns,oledbCn) oledbAdpter.InsertCommand.ExecuteNonQuery() oledbAdpter.Fill(oledbDate,borrow ) DataGrid1.DataSource = oledbDate.Tables( borrow ) Catch err As Exception Msg
Box(err.ToString) Finally If oledbCn.State = ConnectionState.Open Then oledbCn.Close() oledbCn = Nothing End If End Try End Sub 运行有如下
提示..... system.Data.oledb.oledbException:Insert into 语句语法
错误 at system.Data.oledb.oledbcommand.ExcutecommandTextErrorhangdling(int32 hr) at system.Data.oledb.oledbcommand.ExcutecommandTextForsingleResult(tagDBPAAMS dbParams,Object&executeResult) at system.Data.oledb.oledbcommand.ExcutecommandText(Object&executeResult) at system.Data.oledb.oledbcommand.Excutecommand(CommandBehavior behavior,Object&executeResult) at system.Data.oledb.oledbcommand.ExcuteReaderInternal(CommandBehavior behavior,String method) at system.Data.oledb.oledbcommand.ExcuteNoQuery() at adpter1.Form1.Button2_Click(Object sender,EventArgs e) in D:/vb.net练习
数据库/adpter1/Form1.vb:line 152 各位大侠给点意见,谢谢哦... at system.Data.oledb.oledbcommandText(Object&executeResult) __________________________________________________________________________ 补充下 borrowNo文本格式 CardNo文本 BorrowDate日期 oledbIns = insert into borrow (BorrowNo,1987-01-02 ) 是在一行
显示 __________________________________________________________________________ 你这个 ) 是
中文的... 改成) __________________________________________________________________________ 哈哈,最好的
方法就是先写好
sql再粘过来 __________________________________________________________________________ ^_^,谢谢啦,
解决了,这个问题困扰我几天了,真的感谢 amandag(高歌)给你加分 __________________________________________________________________________
原文链接:https://www.f2er.com/vb/263404.html