[VB.NET]大家来关注下这个问题....谢谢啦~~~~~~~~~~~~

VB.NET源码-156个实用实例哦…… <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
大家来关注下这个问题....谢谢啦~~~~~~~~~~~~
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 oledbsql, 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
MsgBox(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,CardNo,BorrowDate)values ( j001 , k002 , 1987-01-02 ) 是在一行显示


__________________________________________________________________________
你这个 ) 是中文的...

改成)
__________________________________________________________________________
哈哈,最好的方法就是先写好SQL再粘过来
__________________________________________________________________________
^_^ ,谢谢啦,解决了,这个问题困扰我几天了,真的感谢
amandag(高歌)给你加分
__________________________________________________________________________
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值