• Notice regarding image hosts and attachments. See here.

INSERT INTO... sql query error

Associate
Joined
12 Aug 2004
Posts
1,009
Location
Glasgow, Scotland
Hi there,

Just wondering if theres something i'm doing wrong with this sql query:

Code:
Set objAdminUsersInsert = objConn.execute("INSERT INTO tblUsers (UserFullName,UserEmail,UserLevel,Username,UserPassword) VALUES ('"& UserFullName &"','"& UserEmail &"','"& UserLevel &"','"& Username &"','"& UserPassword &"') WHERE UserID = "& id &"")

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Missing semicolon (;) at end of SQL statement.
/test/thepines/Website/admin/usersInsertEdit.asp, line 13
I'm trying to edit a row in a database and not sure if i'm using the WHERE clause correctly? I've got it working without using it, so I can insert a new user, but now that i'm trying to edit an already existing one i'm having an error :confused:

Thanks for any help :)
 
JIMA said:
Hi,

Do you want to be doing an UPDATE rather than an INSERT if you want to modify a row of data that already exists? For example:

UPDATE tblUsers
SET userfullname = namehere
WHERE userid = useridinhere

Hope that helps.

Jim

Cheers mate ... I new i wasen't using SQL to its full potential :p

Working perfectly now, thanks a lot :)
 
Back
Top Bottom