我的大脑受伤 - 帮助 [英] My Brain Hurts - Help

查看:48
本文介绍了我的大脑受伤 - 帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如果我运行以下内容:


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 adapter
cb = New OleDb.OleDbCommandBuilder(da) ''Create command builder using the datadapter
dt = New Data.DataTable
da.Fill(dt) ''pour in the data using the adapter

rw = dt.NewRow
rw("ClientID") = GetNextIDNumber("Clients")

CurrentClientID = CLng(rw("ClientID")) ''Set the currentClientID to this new client

rw("RelatedClientLinkID") = CurrentRelatedClientID ''Type is: Long.
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 ''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 String
dt.Rows.Add(rw) ''Add the new row
da.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!

Siv
Martley, Worcester, UK.

推荐答案

西弗,

我认为你的问题在于dob专栏。您正在发送文本,但它需要日期数据。用#包裹它在两端,看看会发生什么。另外,只是为了验证我的信念,只需将其更改为now.date,看看是否确实存在问题。


HTH,


Bernie Yaeger


" Siv" < MS ********** @ removeme.sivill.com>在留言新闻中写道:ek ************** @ TK2MSFTNGP09.phx.gbl ...



如果我跑以下内容:


strSQL =" Select * FROM Clients;"


da = New OleDb.OleDbDataAdapter(strSQL,Conn)' '创建数据适配器

cb =新OleDb.OleDbCommandBuilder(da)''使用datadapter创建命令构建器

dt =新Data.DataTable

da.Fill(dt)''使用适配器倒入数据

rw = dt.NewRow

rw(" ClientID")= GetNextIDNumber (客户)


CurrentClientID = CLng(rw(&ClientID"))'''将currentClientID设置为此新客户端


rw(RelatedClientLinkID)= CurrentRelatedClientID''类型是:长。

rw(IsPrimaryClient)=真

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 Siv,

I think your problem is with the dob column. You are sending it text but it requires date data. Wrap it in "#" on both ends and see what happens. Also, just to verify my belief, simply change it to now.date to see if that is indeed the problem.

HTH,

Bernie Yaeger

"Siv" <ms**********@removeme.sivill.com> wrote in message news:ek**************@TK2MSFTNGP09.phx.gbl...
Hi,
If I run the following:

strSQL = "Select * FROM Clients;"

da = New OleDb.OleDbDataAdapter(strSQL, Conn) ''Create data adapter
cb = New OleDb.OleDbCommandBuilder(da) ''Create command builder using the datadapter
dt = New Data.DataTable
da.Fill(dt) ''pour in the data using the adapter

rw = dt.NewRow
rw("ClientID") = GetNextIDNumber("Clients")

CurrentClientID = CLng(rw("ClientID")) ''Set the currentClientID to this new client

rw("RelatedClientLinkID") = CurrentRelatedClientID ''Type is: Long.
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 ''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 String
dt.Rows.Add(rw) ''Add the new row
da.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!

Siv
Martley, Worcester, UK.


伯尼,

我'我会给你一个回报并报告,如果这就是我会很高兴的!


-

Siv < br $> b $ b Martley,英国伍斯特。

" Bernie Yaeger" <是***** @ cherwellinc.com>在留言新闻中写道:u1 ************** @ TK2MSFTNGP10.phx.gbl ...

嗨西瓦,


我认为你的问题在于dob专栏。您正在发送文本,但它需要日期数据。用#包裹它在两端,看看会发生什么。另外,只是为了验证我的信念,只需将其更改为now.date,看看是否确实存在问题。


HTH,


Bernie Yaeger


" Siv" < MS ********** @ removeme.sivill.com>在留言新闻中写道:ek ************** @ TK2MSFTNGP09.phx.gbl ...



如果我跑以下内容:


strSQL =" Select * FROM Clients;"


da = New OleDb.OleDbDataAdapter(strSQL,Conn)' '创建数据适配器

cb =新OleDb.OleDbCommandBuilder(da)''使用datadapter创建命令构建器

dt =新Data.DataTable

da.Fill(dt)''使用适配器倒入数据

rw = dt.NewRow

rw(" ClientID")= GetNextIDNumber (客户)


CurrentClientID = CLng(rw(&ClientID"))'''将currentClientID设置为此新客户端


rw(RelatedClientLinkID)= CurrentRelatedClientID''类型是:长。

rw(IsPrimaryClient)=真

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,英国伍斯特。
Bernie,
I''ll give that a go and report back, if that''s what it is I''ll be well pleased!

--
Siv
Martley, Worcester, UK.
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message news:u1**************@TK2MSFTNGP10.phx.gbl...
Hi Siv,

I think your problem is with the dob column. You are sending it text but it requires date data. Wrap it in "#" on both ends and see what happens. Also, just to verify my belief, simply change it to now.date to see if that is indeed the problem.

HTH,

Bernie Yaeger

"Siv" <ms**********@removeme.sivill.com> wrote in message news:ek**************@TK2MSFTNGP09.phx.gbl...
Hi,
If I run the following:

strSQL = "Select * FROM Clients;"

da = New OleDb.OleDbDataAdapter(strSQL, Conn) ''Create data adapter
cb = New OleDb.OleDbCommandBuilder(da) ''Create command builder using the datadapter
dt = New Data.DataTable
da.Fill(dt) ''pour in the data using the adapter

rw = dt.NewRow
rw("ClientID") = GetNextIDNumber("Clients")

CurrentClientID = CLng(rw("ClientID")) ''Set the currentClientID to this new client

rw("RelatedClientLinkID") = CurrentRelatedClientID ''Type is: Long.
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 ''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 String
dt.Rows.Add(rw) ''Add the new row
da.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!

Siv
Martley, Worcester, UK.


检查设置da..UpdateCommand.CommandText()=一个有效的插入命令。

Siv < MS ********** @ removeme.sivill.com>在留言新闻中写道:ek ************** @ TK2MSFTNGP09.phx.gbl ...



如果我跑以下内容:


strSQL =" Select * FROM Clients;"


da = New OleDb.OleDbDataAdapter(strSQL,Conn)' '创建数据适配器

cb =新OleDb.OleDbCommandBuilder(da)''使用datadapter创建命令构建器

dt =新Data.DataTable

da.Fill(dt)''使用适配器倒入数据

rw = dt.NewRow

rw(" ClientID")= GetNextIDNumber (客户)


CurrentClientID = CLng(rw(&ClientID"))'''将currentClientID设置为此新客户端


rw(RelatedClientLinkID)= CurrentRelatedClientID''类型是:长。

rw(IsPrimaryClient)=真

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,英国伍斯特。
Check into setting da..UpdateCommand.CommandText() = to a valid insert command.
"Siv" <ms**********@removeme.sivill.com> wrote in message news:ek**************@TK2MSFTNGP09.phx.gbl...
Hi,
If I run the following:

strSQL = "Select * FROM Clients;"

da = New OleDb.OleDbDataAdapter(strSQL, Conn) ''Create data adapter
cb = New OleDb.OleDbCommandBuilder(da) ''Create command builder using the datadapter
dt = New Data.DataTable
da.Fill(dt) ''pour in the data using the adapter

rw = dt.NewRow
rw("ClientID") = GetNextIDNumber("Clients")

CurrentClientID = CLng(rw("ClientID")) ''Set the currentClientID to this new client

rw("RelatedClientLinkID") = CurrentRelatedClientID ''Type is: Long.
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 ''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 String
dt.Rows.Add(rw) ''Add the new row
da.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!

Siv
Martley, Worcester, UK.


这篇关于我的大脑受伤 - 帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆