H-SC
asked on
Error Parsing Query
I have a local database(SQL CE) in my winforms application that I am trying to update with the following code. When the code runs it errors out.
Here is the Error - There was an error parsing the query. [ Token line number = 1,Token line offset = 109,Token in error = ) ]
Here is my code:
Dim myConn2 As SqlServerCe.SqlCeConnectio n = New SqlServerCe.SqlCeConnectio n("DataSou rce=|DataD irectory|\ SSI.sdf")
Try
Catch ex As Exception
End Try
myConn2.Open()
Dim command2 As New SqlServerCe.SqlCeCommand(" insert into insp_def_buildings(interna lctl)selec t ctl_num from buildings_rooms where buildings_rooms.sel = 1)", myConn2)
command2.ExecuteNonQuery()
command2.Dispose()
myConn2.Dispose()
Here is the Error - There was an error parsing the query. [ Token line number = 1,Token line offset = 109,Token in error = ) ]
Here is my code:
Dim myConn2 As SqlServerCe.SqlCeConnectio
Try
Catch ex As Exception
End Try
myConn2.Open()
Dim command2 As New SqlServerCe.SqlCeCommand("
command2.ExecuteNonQuery()
command2.Dispose()
myConn2.Dispose()
ASKER
philipjonathan,
many thanks....I just tried that and I still keep getting that same error. I have started developing this application and am using compact edition for the sync advantages, however if I can't run standard sql against CE then it is a show stopper for me, I can't seem to figure this one out. I have read that nested selects and CE do not work well together. This may be a case of just that and I will have to look for another route to take to get the sync capabilities that I am needing for this particular project.
many thanks....I just tried that and I still keep getting that same error. I have started developing this application and am using compact edition for the sync advantages, however if I can't run standard sql against CE then it is a show stopper for me, I can't seem to figure this one out. I have read that nested selects and CE do not work well together. This may be a case of just that and I will have to look for another route to take to get the sync capabilities that I am needing for this particular project.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
philipjonathan,
Thats it!
Your suggestions did it. Here is what I ended up with
("insert into insp_def_buildings(interna lctl) select ctl_num from buildings_rooms where buildings_rooms.sel = 1", myConn2)
many thanks for your help on this problem.
Thats it!
Your suggestions did it. Here is what I ended up with
("insert into insp_def_buildings(interna
many thanks for your help on this problem.
Well, actually I just give you another pair of eyes to look at the SQL queries. SQL queries are always prone to syntax error because it's not checked in compile time. Glad that you made it :)
"insert into insp_def_buildings(interna