I am doing mysql connection by establishing a user-registration application. I use Delphi 7. Myquery (MySQL Access Set) have a problem with adding user information.
MyQuery1.SQL.Clear;
MyQuery1.SQLInsert.Add('INSERT INTO uyeler (nick) VALUES ('+QuotedStr(DBEdit1.text)+')');
MyQuery1.SQLInsert.Add('INSERT INTO uyeler (mail) VALUES ('+QuotedStr(DBEdit2.text)+')');
MyQuery1.SQLInsert.Add('INSERT INTO uyeler (site) VALUES ('+QuotedStr(DBEdit3.text)+')');
MyQuery1.SQLInsert.Add('INSERT INTO uyeler (pass) VALUES ('+QuotedStr(DBEdit4.text)+')');
MyQuery1.CachedUpdates:=True;
MyQuery1.Open;
Error message: MyQuery1: No SQL statement provided.
Note: uyeler: members table.
This message is raised because you are not filling the
SQL
property, instead you are using theSQLInsert
which is a template for query statements.Some additional tips
Execute
method, TheOpen
method is forSELECT
sentences.use a single insert sentence like
INSERT INTO uyeler (nick,mail,site,pass) VALUES ('','','','')
Try using parameters, instead of passing the string values directly, in this way you will avoid sql injection attacks and you will increase the performance.