PDA

Click to See Complete Forum and Search --> : Need Help How To Update Db


Jony5
Jun 9th, 2000, 07:04 PM
I have a prob in updateing my db
I tried :

DbCon.Execute " update tbl1 set (fname = '" & FnameTxt & "' , lname = '" & LnameTxt & "' , dateofbirth = '" & DateofbirthTxt & "' , where id = '" & IdTxt & "')"

but it dosent work for a reason

Thnks in advance 4 your help ...

J5

Chris
Jun 9th, 2000, 11:23 PM
Missing semocolon at the end of the statement

DbCon.Execute "update tbl1 set fname = '" & FnameTxt & "', lname = '" & LnameTxt & "', dateofbirth = '" & DateofbirthTxt & "', where id = '" & IdTxt & "'"


should be like this...

DbCon.Execute "update tbl1 set fname = '" & FnameTxt & "', lname = '" & LnameTxt & "', dateofbirth = '" & DateofbirthTxt & "', where id = '" & IdTxt & "';"




[Edited by Chris on 06-11-2000 at 02:50 PM]

Jony5
Jun 10th, 2000, 04:45 AM
Well Chris 10x 4 your help
But it dosent work i dont know
why ...

But again 10x

JHausmann
Jun 10th, 2000, 04:50 AM
Standard SQL (you can include theJet Update statement, too) doesn't use paren's after the set command. Have you tried:

DbCon.Execute "update tbl1 set fname = '" & FnameTxt & "', lname = '" & LnameTxt & "', dateofbirth = '" & DateofbirthTxt & "', where id = '" & IdTxt & "'"

Chris
Jun 10th, 2000, 12:00 PM
Originally posted by Jony5
Well Chris 10x 4 your help
But it dosent work i dont know
why ...


BTW, may i know the datatype in each fields?

Jony5
Jun 10th, 2000, 02:30 PM
Well all the fileds is text
expet the last one that he is a date

but i dont care to take him as a string
and later on i`ll fix it

Chris
Jun 10th, 2000, 05:51 PM
It have extra comma before the WHERE Clause,

DbCon.Execute "update tbl1 set fname = '" & FnameTxt & "', lname = '" & LnameTxt & "', dateofbirth = '" & DateofbirthTxt & "', where id = '" & IdTxt & "';"


should be like this...

DbCon.Execute "UPDATE tbl1 SET fname = '" & FnameTxt & "', lname = '" & LnameTxt & "', dateofbirth = '" & DateofbirthTxt & "' WHERE id = '" & IdTxt & "';"