Update Statement
-
hi all this is killing me this statement appears to be correct but not sure
strSQLUpdate = "UPDATE Software SET ((Name), (Description), (Version), (ProductKey), (Location)) = (['" & n & "'] , ['" & d & "'], ['" & v & "'], ['" & p & "'], ['" & l & "']) WHERE (Name) = {'" & n & "'}"
i have tried with ( ) & with out { } as well VB6 app to ms access.mdb please help thank you :confused: Help is great only if you ask correctly :) -
hi all this is killing me this statement appears to be correct but not sure
strSQLUpdate = "UPDATE Software SET ((Name), (Description), (Version), (ProductKey), (Location)) = (['" & n & "'] , ['" & d & "'], ['" & v & "'], ['" & p & "'], ['" & l & "']) WHERE (Name) = {'" & n & "'}"
i have tried with ( ) & with out { } as well VB6 app to ms access.mdb please help thank you :confused: Help is great only if you ask correctly :)Too many brackets for a start. What's going wrong ? What are you setting Name, Description, Version, etc. to. If nothing, take them out, if something, specify it. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
-
hi all this is killing me this statement appears to be correct but not sure
strSQLUpdate = "UPDATE Software SET ((Name), (Description), (Version), (ProductKey), (Location)) = (['" & n & "'] , ['" & d & "'], ['" & v & "'], ['" & p & "'], ['" & l & "']) WHERE (Name) = {'" & n & "'}"
i have tried with ( ) & with out { } as well VB6 app to ms access.mdb please help thank you :confused: Help is great only if you ask correctly :)Correct me if I'm wrong, but I think the syntax you used is only for INSERT (well, not quite, but similiar), not UPDATE. Try modifying your statement to:
"UPDATE Software SET Name = '" & n & "', Description = '" & d &"', Version = '" & v & "'" WHERE Name = '" & n & "'
Also, you don't need to set the name when it is used as the condition as the name would have the same value anyway. Hope it helps :) Edbert P. Sydney, Australia.
-
Correct me if I'm wrong, but I think the syntax you used is only for INSERT (well, not quite, but similiar), not UPDATE. Try modifying your statement to:
"UPDATE Software SET Name = '" & n & "', Description = '" & d &"', Version = '" & v & "'" WHERE Name = '" & n & "'
Also, you don't need to set the name when it is used as the condition as the name would have the same value anyway. Hope it helps :) Edbert P. Sydney, Australia.
-
hi all this is killing me this statement appears to be correct but not sure
strSQLUpdate = "UPDATE Software SET ((Name), (Description), (Version), (ProductKey), (Location)) = (['" & n & "'] , ['" & d & "'], ['" & v & "'], ['" & p & "'], ['" & l & "']) WHERE (Name) = {'" & n & "'}"
i have tried with ( ) & with out { } as well VB6 app to ms access.mdb please help thank you :confused: Help is great only if you ask correctly :)I recommend using parametized queries. See the documentation for the
Parameters
property of theOleDbCommand
/SqlDbCommand
classes. With parametized queries you avoid problems like invalid characters (a quote for example) or someone trying to hijaack your database by inserting SQL statements. EDIT: See this[^] post. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!