* * *

Author Topic: SQLQuery1.Update Problems [MySQL 5.0]  (Read 1405 times)

Kizbits2000

  • Newbie
  • Posts: 3
SQLQuery1.Update Problems [MySQL 5.0]
« on: July 31, 2010, 04:06:07 am »
Hey all,

Sorry to be a bother yet again. But I have finally sorted the problem from last time and I now have a fully working log-in system for my game, Problem is I am trying to create a 'Ban' System, So that it is possible to ban players from the game, Only trouble is I am having problems updating my database... Since most of my game is going to based around the SQLQuery1.Update Procedure, this is a bit of a kick in the man-hood.

This is my code:
Code: [Select]
procedure TForm1.Button10Click(Sender: TObject); //Admin Clicks Ban Button
begin
     MySQL50Connection1.Connected:= False;
     Isbanq:= #39+IntToStr(1)+#39; //VAR 'Isbanq' will equal '1'
     User2ban:= #39+Edit8.Text+#39; //The user to ban will be Edit8.Text
     SQLQuery1.SQL.Clear; //Clearing the Current SQL...
//Only added below as I am new to SQL and didn't know if this would solve the problem or not
     SQLQuery1.SQL.Text:= 'SELECT Username AS Username, IsBanned AS IsBanned FROM Users WHERE username='+User2Ban;
//This should be the SQL Update set, The syntax is correct as far as I am aware, since it works in the 'MySQL Workbench'
     SQLQuery1.UpdateSQL.Text:= 'UPDATE Users SET isBanned='+Isbanq+' WHERE Username='+User2ban;
//Open the SQL So it should all work perfectly... I think =/
     SQLQuery1.Open;
end;

I have run this but it doesn't do anything to the database, Nor does it return any errors... Very odd.
Any Idea's on how to fix this? Any help would be greatly appreciated and your Name will feature in the game credits obviously.

Sorry for being a pain in the a** once again.

Thanks

Kiz

krexon

  • Jr. Member
  • **
  • Posts: 57
Re: SQLQuery1.Update Problems [MySQL 5.0]
« Reply #1 on: July 31, 2010, 01:12:27 pm »
When I insert or update MySQL I do it in such way:
Code: [Select]
sqlquery.sql.text:='UPDATE ....'
sqlquery.execsql
sqlquery.close

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads