Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating mySQL database

Status
Not open for further replies.

BlastRadius

Programmer
Nov 13, 2001
38
0
0
CA
This is a simple question but I am having a problem with the syntax for the SQL update command. I have an example code which will update all records where say a = c to update c to d. Which is great but I am wanting to update every field here is the code. Below is the code I used on my last attemp to get this to work. Normally I use the recordset to update, create, delete when I am using an access database but this doesn't seem to work properly with mySQL. Thanks in advance for any help offered.

"UPDATE Events SET EName= '" & strEvent & "'" & "EDesc ='" & strDetails & "'" & "SDate ='" & strSdate & "'" & "EDate ='" & strEDate & "'" & "Ministry = '" & strMinistry & "'" & "Flag = '"&strFlag&"'" & "Contact = '" & strContact & "'" & "URL = '" & strURL & "'" & "WHERE ID = '" & recordID & "'"
 
Use this :

"UPDATE Events SET EName= '" & strEvent & "'" & ",EDesc ='" & strDetails & "'" & ",SDate ='" & strSdate & "'" & ",EDate ='" & strEDate & "'" & ",Ministry = '" & strMinistry & "'" & ",Flag = '"&strFlag&"'" & ",Contact = '" & strContact & "'" & ",URL = '" & strURL & "'" & "WHERE ID = '" & recordID & "'"

Hope trhis works .... in the sql st .. neither blank spaces nor commas were used ...
 
Use this :

"UPDATE Events SET EName= '" & strEvent & "'" & ",EDesc ='" & strDetails & "'" & ",SDate ='" & strSdate & "'" & ",EDate ='" & strEDate & "'" & ",Ministry = '" & strMinistry & "'" & ",Flag = '"&strFlag&"'" & ",Contact = '" & strContact & "'" & ",URL = '" & strURL & "'" & "WHERE ID = '" & recordID & "'"

Hope trhis works .... in the sql st .. commas were not used ...
 
Thanks SrinuReddy I have it working with your first example. It helped alot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top