Update Progress

mrprogman

New Member
Hi....i need update progress database , i got this code..but i got this error..

[h=2]ERROR [HY000] [DataDirect][ODBC OPENEDGE driver][OPENEDGE]Syntax error in SQL statement at or about ".ar.abal = '0' where PUB.ar.anum = '35" (10713)[/h]
Dim cadtexto2 As String
Dim rg2 As Integer


Dim MyConnection2 As System.Data.Odbc.OdbcConnection = New System.Data.Odbc.OdbcConnection("Driver={Progress Openedge 10.1A Driver};DSN=PROGRESS;DB=pace;UID=sysprogress;PWD=password;HOST=192.168.10.227;PORT=2571;")


'myConnection2 = New SqlConnection("DSN=PROGRESS;DB=pace;UID=sysprogress;PWD=password;HOST=192.168.10.227;PORT=2571;")


myConnection2.Open()


cadtexto2 = "update PUB.ar Set PUB.ar.abal = '" + TextBox1.Text + "' where PUB.ar.anum = '" + TextBox2.Text + "' "


Dim myCmd As New Odbc.OdbcCommand(cadtexto2, MyConnection2)
'myCommand2 = New SqlCommand(cadtexto2, MyConnection2)


rg2 = myCmd.ExecuteNonQuery()
'myConnection.Close()


MyConnection2.Close()
Server.Transfer("Default.aspx")


anybody help me..?..
 
My guess is that you need to enclose the table and table.field references in double quotes, e.g. PUB."ar" or PUB."ar.abal"; SQL is picky about that. Of course, you'll have to do whatever is necessary in VB to escape the quotes so they don't delimit your strings.

As far as the rest of the code goes I can't offer any help, but that appears to be where it is breaking down.
 
true, 10713 status code means a reserved key was used and need to be quoted... not sure which one that would be (ar, abal, anum) but just to be sure (and safe from future additions in later versions) go ahead and quote every table/field names ("ar"."abal", "ar"."anum").

on the other hand the way you construct the statement from user input does not look like the best thing to do :)

check out statement parameters, should give you a safer approach.
 
Back
Top