procedure TForm1.FormCreate(Sender: TObject);
var i: integer;
begin
host := '
myhost.webpack.hosteurope.de';
user := '
MeMeMe';
pass := '
myPass';
db := '
myDB';
//jetzt wird _myCon initialisiert
libmysql_load(
nil);
_myCon := mysql_init(
nil);
mysql_real_connect(_myCon, host, user, pass,
db, 3306,
nil, 0);
if _myCon =
nil then
showmessage('
Verbindung konnte nicht hergestellt werden.');
SG1.Cells[0, 0] := '
Report-Nr.';
SG1.Cells[1, 0] := '
Überschrift';
query := PChar('
SELECT * FROM t_Projects ORDER BY id');
mysql_real_query(_myCon, PAnsiChar(
query), Length(
query));
_myRes := mysql_store_result(_myCon);
if _myRes =
nil then
begin
ShowMessage(mysql_error(_myCon));
Exit;
end;
SG1.RowCount := mysql_num_rows(_myRes) + 2;
for i := 0
to mysql_num_rows(form1._myRes)
do
begin
_myRow := mysql_fetch_row(_myRes);
//Datensatz abholen
SG1.Cells[i, 0] := form1._myRow[0];
SG1.Cells[i, 1] := form1._myRow[1];
end;
mysql_free_result(_myRes);
end;