Advise Needed - Trying to get Results of a SQL Command
Posted
#1
(In Topic #1563)
Enthusiast

I am in need of some wisdom from someone.
I have the following SQL Command
UPDATE journalroll SET journalentry = Replace(journalentry, '?ú', '£') WHERE INSTR(journalentry, '?ú');
When I run it with in my Gambas App I don't get any results back but If I run it in the HeidiSQL interface it reports
back to me 4,278 rows affected
How Do I capture the affected rows and show it on screen? I did think to try the following
but in the Debug panel get a 0
IF Someone has a better way of remove the ?ú and replacing it with a £ I am willing to update my code as I would like to keep the database as clean as I can.
I look forward to hearing from you all with your idea's
Andy
Posted
Administrator

1. reading the database and assigning the offending database field to a variable
2. cleaning up the data
3. writing the cleaned up data back into the database
Each step is a separate routine. I did it this way to make it easier to keep the thought process in my head clear and to make debugging easier.
It looks like you are combining steps 2 and 3 together.
My step 2 is straight forward:
Code (gambas)
- ' I have 40+ of these to pass sPost_Text through
My step 3 is:
Code (gambas)
- MGlobal.hDB.Begin
- sCriteria = "post_id = &1"
- MGlobal.hResData = MGlobal.hDB.Edit("phpbb_posts", sCriteria, iRecordID)
- MGlobal.hResData!post_text = sPost_Text
- MGlobal.hResData.Update()
- MGlobal.hDB.Commit
1 guest and 0 members have just viewed this.




