palmarosa 04-14-2004, 08:29 PM it gives me an error : Syntax Error (comma) in query Expression ...
i can't see what's wrong...
someone help !!
Tec,Tec1,GrupoEco,GrupoEco1,Central,Central1 are string
Pot, Pot1 are single
MyDBConn.Execute ("UPDATE Centrais_Termicas_PT SET Potência_Instalada='" & Pot1 & "', Grupo_Económico='" & GrupoEco1 & "', Tecnologia='" & Tec1 & "', Central='" & Central1 & "' WHERE Potência_Instalada='" & Pot & "', Grupo_Económico='" & GrupoEco & "', Tecnologia='" & Tec & "', Central='" & Central & "'")
Thanks all :)
quynhtuan 04-14-2004, 08:40 PM it gives me an error : Syntax Error (comma) in query Expression ...
i can't see what's wrong...
someone help !!
Tec,Tec1,GrupoEco,GrupoEco1,Central,Central1 are string
Pot, Pot1 are single
MyDBConn.Execute ("UPDATE Centrais_Termicas_PT SET Potência_Instalada='" & Pot1 & "', Grupo_Económico='" & GrupoEco1 & "', Tecnologia='" & Tec1 & "', Central='" & Central1 & "' WHERE Potência_Instalada='" & Pot & "', Grupo_Económico='" & GrupoEco & "', Tecnologia='" & Tec & "', Central='" & Central & "'")
Thanks all :)
I think you should remove the brackets in your SQL string. Please try:
Dim sSQL as String
sSQL= "UPDATE Centrais_Termicas_PT SET Potência_Instalada='" & Pot1 & "', Grupo_Económico='" & GrupoEco1 & "', Tecnologia='" & Tec1 & "', Central='" & Central1 & "' WHERE Potência_Instalada='" & Pot & "', Grupo_Económico='" & GrupoEco & "', Tecnologia='" & Tec & "', Central='" & Central & "'"
MyDBConn.Execute sSQL
MKoslof 04-15-2004, 06:32 AM No the brackets are fine. The issue is, you say two of your values are singles, or integer values. For strings you want to use the quoted values such as:
"Field = '" & Text1.Text & "'"
For numeric values you want to drop the quotes such as:
"Field1=" & Pot1
So, go back and review which of these fields are numeric and modify your command string.
Andyh 04-15-2004, 07:59 AM I think the clue is in the error message, It could also be that some of your string parameters may contain a quote mark ('). If this is possible in any of the fields you must double them up:
e.g. replace GrupoEco1 with replace(GrupoEco1 , "'", "''") etc....
MKoslof 04-15-2004, 08:02 AM No, read the comments :).
Pot, Pot1 are single
These are INTEGER data types, he then needs to declare them properly in his update statement without the quotes.
Andyh 04-15-2004, 08:04 AM No, read the comments :).
Pot, Pot1 are single
These are INTEGER data types, he then needs to declare them properly in his update statement without the quotes.
Hi, You read my reply before I changed it to refer to one of the strings!
MKoslof 04-15-2004, 08:07 AM OK, fair enough, I won't bite your head off :)
wayneph 04-15-2004, 08:37 AM Doesn't the WHERE clause need "AND" instead of commas?
MyDBConn.Execute ("UPDATE Centrais_Termicas_PT SET Potência_Instalada=" & Pot1 & ", Grupo_Económico='" & GrupoEco1 & "', Tecnologia='" & Tec1 & "', Central='" & Central1 & "' WHERE Potência_Instalada=" & Pot & " AND Grupo_Económico='" & GrupoEco & "' AND Tecnologia='" & Tec & "' AND Central='" & Central & "'")
MKoslof 04-15-2004, 08:39 AM One of many problems. We need to get the data types correct first, using the proper syntax for number and strings. But yes, we have overlooked that so far, you need the AND between the Where clauses.
|