For some reason that I can't explain, I have gotten past the previous problems. I was thinking I'd try the "SQLQuery1.Open;" again instead of "SQLQuery1.ExecSQL;" and maybe the "SQLQuery1.First;" statement would then work. It did!!!! Here's what I used:
// First lets get a list of available databases.
if MySQLConnection1.Connected then begin
ShowString('Connected to server: ' + HostEdit.Text);
ShowString('Retrieving list of available databases.');
SQLQuery1.SQL.Text := 'show databases';
SQLQuery1.Open;
{SQLQuery1.ExecSQL;}
if SQLQuery1.Active then begin
SQLQuery1.First;
ShowString('SQLQuery1 is Active');
end
else
ShowString('SQLQuery1 is not Active');
while not SQLQuery1.EOF do begin
ShowString('Inside loop');
DatabaseComboBox.Items.Add(SQLQuery1.Fields[0].AsString);
SQLQuery1.Next ;
end;
SQLQuery1.Close;
ShowString('List of databases received!');
end;
Out of curiosity, I commented out the "if SQLQuery1.Active then begin" statements and re-ran the program. And to my surprise it also ran without any errors! In both variations the DatabaseComboBox was filled with the database names in my MySQL.
I'm not sure how to explain this because now I am back to the original code that was used in the tutorial!!!! And this is what caused arwen to originate this thread. Arwen (using Windows) and I (using Linux) would get an error stating:
MySQLConnection1: Error executing query: You have an error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near " at line 1.
Maybe one of the Lazarus developers can shed some light on this.
Now that I got past that problem, with the program still running, in the DatabaseComboBox, I clicked on a simple database I had created in MySQL called "addressbook" with a table called "tbl_friends". When I clicked the SelectDBButton I got the following error:
Operation cannot be performed on an active dataset.
I am still looking at this latest problem and will post any progress I make to this thread. I suppose I should post to this thread. Maybe I should start a new thread?