how to update a record in MYSQL


Recommended Posts

-first problem :

please give me example how to use db.execute() , i is always giving error 

i can do this using mysql,  

select* from table1;
update table1 
set NAME = 'xyz' 
where ID=60 ;

how i can do in daqfactory 



- second problem :

when i try to search about id =60 i table it working fine  

qr = db.Query(dbase,"select * from table1 where ID = '60'")

the problem when i replace this with normal variable it is not working 

qr = db.Query(dbase,"select * from table1 where ID = var10")

how to write this using variable 

please give me the refrence that explain  db.execute()

i cant find in normal help 



Link to comment
Share on other sites

private dbase ="mydatasource")
private result = db.queryToClass(dbase, "select * from table1;")
db.execute(dbase, "update table1 set NAME = 'xyz' where ID=60")

As to your second problem, the ODBC database doesn't know anything about the internal variables of DAQFactory.  It gets the string that you provide in execute() or query().  So, you need to make create the string out of the variable:

qr  = db.query(dbase, "select * from table1 where ID = " + var10)

Also, I recommend using queryToClass() instead of query() for just about everything.  It is much faster and easier to use.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.