Recent

Author Topic: MySQL ?  (Read 4617 times)

thaimann

  • Jr. Member
  • **
  • Posts: 84
MySQL ?
« on: October 25, 2006, 09:46:29 pm »
How do you issue a "Show Databases" Programatically?

I tried it once and it gave me an error every time?

What about "Show tables" and "Show Columns"?

Thx,   Terry

CCRDude

  • Hero Member
  • *****
  • Posts: 600
RE: MySQL ?
« Reply #1 on: October 25, 2006, 11:13:27 pm »
MySQL Cookbook - really helpful for MySQL.
MySQL documentation - really helpful for MySQL.
Lazarus forum - for Lazarus questions.
Something doesn't work - not really a helpful problem description.

That said, "SHOW DATABASES;" and "SHOW TABLES;" are valid MySQL commands.

thaimann

  • Jr. Member
  • **
  • Posts: 84
MySQL ?
« Reply #2 on: October 26, 2006, 04:45:00 am »
Ok,

If I do the following:

procedure TForm1.TestButClick(Sender: TObject);
begin
     MyQuery.SQL.Text := 'Show Databases';
     MyQuery.Active   := True;
end;              

I get an error message that says something like:

MyDB:  Error executing query.  You have an error in your SQL syntax ...

I would like to get the list of databases back as some sort of query or table that I can step through and place in a listbox or something.

Terry

CCRDude

  • Hero Member
  • *****
  • Posts: 600
MySQL ?
« Reply #3 on: October 26, 2006, 11:55:26 am »
An ending semicolon is always helpful (though not always required, it can't harm, because then you won't forget it when it's needed).

What kind of database server is it? If it's a MySQL server, have you tried with phpMyAdmin on the same SQL server?

Is the user account you used to log into the database server valid?

The part you wrote as "..." is probably the important part, since there you'll usually find at which place of the instruction the error is.

thaimann

  • Jr. Member
  • **
  • Posts: 84
MySQL ?
« Reply #4 on: October 27, 2006, 04:26:09 am »
The server is mysql 4.1.11, the user was my "Root MySQL User" or otherwise "All Powerful."

I can actually do this using my Delphi Component "MySQL DAC," but I can't seem to do it using Lazarus.  But as I recall I had to do it through some back door with MySQLDAC and I am assuming there is a way to do it with Lazarus, but I am not sure how.

 

TinyPortal © 2005-2018