本文介绍了我的大脑受伤 - 帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 如果我运行以下内容: strSQL =" Select * FROM Clients;" da =新OleDb.OleDbDataAdapter(strSQL,Conn)''创建数据适配器 cb =新OleDb.OleDbCommandBuilder(da)''使用datadapter创建命令构建器 dt = New Data.DataTable da.Fill(dt)''使用适配器倒入数据 rw(" ClientID")= GetNextIDNumber(" Clients") CurrentClientID = CLng(rw(" ClientID"))''设置currentClientID到这个新客户端 rw(" RelatedClientLinkID")= CurrentRelatedClientID''类型是:长。 rw(" IsPrimaryClient")= True rw(" Title")= txtTitleSelf.Text''Type is:String。 rw(" ; Forename")= txtForenameSelf.Text''Type is:String。 rw(" OtherNames")= txtOtherNameSelf.Text''Type is:String。 rw (" Surname")= txtSurnameSelf.Text''Type is:String。 rw(" RelationshipToPartner")= txtRelToPartnerSelf.Text''Type is:String。 rw(DOB)= txtDOBYYYYSelf.Text& " - " &安培; txtDOBMMSelf.Text& " - " &安培; txtDOBDDSelf.Text''类型是:日期。 rw(" StateOfHealth")= txtStateOfHealthSelf.Text''Type is:String。 rw(" SmokerYN" )= chkSmokerSelf.Checked''Type is:Boolean。 rw(" Notes")= txtNotesSelf.Text''Type is:String。 rw(" DateCreated")= Now''Type is:Date。 rw(" User")= CurrentUser''Type is String dt.Rows.Add(rw) ''添加新行 da.Update(dt)''使用适配器将更新发送到实际数据库 在da.Update( dt)第一行抛出异常抛出:INSERT INTO语句中的语法错误。 我有其他使用相同技术的代码,我没有收到错误一点都不我已经尝试过更改strSQL文本,这样它就会变得更加复杂而没有任何区别。 如果有人能看到我正在制造的明显错误,请让我摆脱痛苦! Siv Martley,英国伍斯特。 Hi,If I run the following: strSQL = "Select * FROM Clients;" da = New OleDb.OleDbDataAdapter(strSQL, Conn) ''Create data adaptercb = New OleDb.OleDbCommandBuilder(da) ''Create command builder using the datadapterdt = New Data.DataTableda.Fill(dt) ''pour in the data using the adapter rw = dt.NewRowrw("ClientID") = GetNextIDNumber("Clients") CurrentClientID = CLng(rw("ClientID")) ''Set the currentClientID to this new client rw("RelatedClientLinkID") = CurrentRelatedClientID ''Type is: Long.rw("IsPrimaryClient") = Truerw("Title") = txtTitleSelf.Text ''Type is: String.rw("Forename") = txtForenameSelf.Text ''Type is: String.rw("OtherNames") = txtOtherNameSelf.Text ''Type is: String.rw("Surname") = txtSurnameSelf.Text ''Type is: String.rw("RelationshipToPartner") = txtRelToPartnerSelf.Text ''Type is: String.rw("DOB") = txtDOBYYYYSelf.Text & "-" & txtDOBMMSelf.Text & "-" & txtDOBDDSelf.Text ''Type is: Date.rw("StateOfHealth") = txtStateOfHealthSelf.Text ''Type is: String.rw("SmokerYN") = chkSmokerSelf.Checked ''Type is: Boolean.rw("Notes") = txtNotesSelf.Text ''Type is: String.rw("DateCreated") = Now ''Type is: Date.rw("User") = CurrentUser ''Type is Stringdt.Rows.Add(rw) ''Add the new rowda.Update(dt) ''Send the update to the actual database using the adapter At the da.Update(dt) line I det an exception thrown: "Syntax error in INSERT INTO statement." I have other code that uses the same technique and I don''t get an error at all. I have tried changing the strSQL text so that it is more complex and it makes no difference.If anyone can see the glaring mistake that I am making please put me out of my misery! SivMartley, Worcester, UK.推荐答案 这篇关于我的大脑受伤 - 帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-16 23:30