I found an example of MySQL usage with Lazarus on the Lazarus Wiki at http://wiki.lazarus.freepascal.org/MySQLDatabases. It is a program called ptrymysql, downloadable from SourceForge at
http://sourceforge.net/project/downloading.php?groupname=lazarus-ccr&filename=mysql_demo_20050408.tar.gz&use_mirror=voxel
It appears to be recently updated for MySQL 5 (the wiki article mentions 4.1 in several places). I downloaded it and tried it with a table that I created using the following SQL:
CREATE TABLE ZIPCODE
(
ZIPID INT NOT NULL AUTO_INCREMENT,
ZIP VARCHAR(5) NOT NULL,
ZIPEXT VARCHAR(4),
CITY VARCHAR(40),
STATE VARCHAR(2),
PRIMARY KEY(ZIPID)
);
INSERT INTO ZIPCODE (ZIP,ZIPEXT,CITY,STATE) VALUES ('01814',NULL,'Lawrence','MA')
,('13502',NULL,'Utica','NY')
,('22030',NULL,'Fairfax','VA')
,('27030',NULL,'Mt. Airy','NC')
,('27103',NULL,'Winston-Salem','NC')
,('27104',NULL,'Winston-salem','NC')
,('27106',NULL,'Winston-Salem','NC')
,('30084',NULL,'Tucker','GA')
,('36509',NULL,'Bayou La Battre','TN')
,('37211',NULL,'Nashville','TN')
;
I was able to connect to the database, find the table (and it showed the fields), but when I tried to enter a select statement (select * from zipcode) into the text box, and tried to run it with the "open query" button, I got a Runtime error 103 following by an exception message "ElnOutError" "File not open".
I tracked through it with the debugger, and everything looks ok up until the SQLQuery1.open statement. I have no trouble accessing this database from the MySQL command line.
Can somebody please send me a clue? I'm trying to complete what should be a very simple program, and I'm dead in the water.
