Click to See Complete Forum and Search --> : a simple syntax error...


stinkysGTI
08-22-2007, 04:57 PM
I'm very new to asp/ms sql structure. i come from a php/mysql world :)

So here's my problem

I'm trying to insert data into a database using the following code:

g_strQuery = "UPDATE [stories] SET "
g_strQuery &= "headline='" & SQL_Format( Form_Value( "headline" ) ) & "'" & "," & " "
g_strQuery &= "copy='" & SQL_Format( Form_Value( "copy" ) ) & "'" & "," & " "
g_strQuery &= "link='" & SQL_Format( Form_Value( "link" ) ) & "'" & "," & " "
g_strQuery &= "excerpt='" & SQL_Format( Form_Value( "excerpt" ) ) & "'" & "," & " "
g_strQuery &= "WHERE ( StoryID='" & strID & "' );"


All it's doing is adding a new row into the DB, but every column (except auto-inc ID) is NULL and I get this error:

Incorrect syntax near the keyword 'WHERE'.


It looks fine to me though. Am I just missing some little thing here??

thank you for any help you may have

stinkysGTI
08-22-2007, 05:33 PM
i figured it was a pretty general sql syntax question and error and I'm not sure of the versions other than its asp and its using a ms sql server. 2000 i think though

stinkysGTI
08-22-2007, 05:48 PM
ok, i'm retarded
i had an extra "," just before the WHERE

arrgh