DBGrid scroll only when using MyDac [Beginner]

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mierlp
Posts: 29
Joined: Thu 26 Jan 2006 08:34
Location: Nederlands

DBGrid scroll only when using MyDac [Beginner]

Post by mierlp » Tue 07 Feb 2006 22:05

hi,

Before a week i used alway DBISAM dabases..now i swiched to
MySQL and MyDAC components.

I've got 2 questions....

1. what's the best...using MyQuery to connect to a datasource and
then assing on standaard DBEdits or using a MyTable component,
so just for adding, changing, deleting records ?

2. When using the standaard DBGrid and using MySql and MyDAC when i
move my mouse up/down over a DBGrid the Indicator also moves
up and down...which is a strange behavoir

I had to finish a DBISAM project there i don't have this problem...so
i thought...lets copy the dbgrid and put i on my new sql project...
connect a MyQuery...and the same strange behavior is there.

Is this something in MySql or MyDac...and where do i have to look
for a solution

mierlp
Posts: 29
Joined: Thu 26 Jan 2006 08:34
Location: Nederlands

Post by mierlp » Tue 07 Feb 2006 22:30

Hi,

I found the problem for the scrolling of the dbgrid indicator when moving the mouse over the dbgrid. A TForm has a .AutoScroll, which i set
first to TRUE and then to FALSE, compiled the project and no more
scrolling.

A little strange behavior somewhere in my project/delphi

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Wed 08 Feb 2006 00:12

Hi mierlp, i've been using DBISAM also for quite a long time, along other components. Now i do almost everything with myDac, using TmyQuery, which behave excellent.. In some rather cases i use TMyTables, but think about this is a wrapper of TMyQuery. For speed improvments always check keys etc, and try to drill down data requests at lowest level (Let's say it's better to do a query for a specific record instead of retrieving all records and locate the one you need)... Also add primary autoinc fields to tables, and include them in your select statements, this will improve also a lot.

Regards

mierlp
Posts: 29
Joined: Thu 26 Jan 2006 08:34
Location: Nederlands

Post by mierlp » Wed 08 Feb 2006 20:30

Hi GEswin,

DBISAM is also a nice database..MySQL is new to me ...so i've one little
quiestion regarding error codes. Within my datamodule for DBISAM i
defined the follow codes:

const
{Declare constants we're interested in}
DBISAM_RECLOCKFAILED =10258;
DBISAM_KEYORRECDELETED =8708;
DBISAM_INDEXCORRUPT =8965;
DBISAM_KEYVIOL =9729;

On a table i use a OnDeleteError procedure with this code :

if (E is EDBISAMEngineError) then begin
if (EDBISAMEngineError(E).ErrorCode=DBISAM_RECLOCKFAILED) then begin
Application.MessageBox('Record is in use.', 'Warning', MB_OK+MB_ICONEXCLAMATION+MB_DEFBUTTON1+MB_APPLMODAL);
Action:=daAbort;
end;
end;

How does this work with MySql, are there also error codes and can i use
them. I use NaviCat for creating tables...do i have to define Foreign keys and does that also work with MyISAM table types

Greetz
Peter

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 09 Feb 2006 10:41

>How does this work with MySql, are there also error codes and can i use them.

I don't think that DBISAM error codes and MySQL error codes are the same. If you want to work with locking issues, try to look at MyDAC Lock demo, it may be useful for you.

> do i have to define Foreign keys and does that also work with MyISAM table types

Quote from MySQL Reference Manual:
For the moment, only InnoDB tables support foreign keys. See Section 14.2.6.4, “FOREIGN KEY Constraints”. Foreign key support in MyISAM tables is scheduled for implementation in MySQL 5.1.

Post Reply