Page 1 of 1
how to make check table with myDAC
Posted: Sun 11 Mar 2007 13:29
by putukaca
hi
can myDAC do something like check, repair, optimize and so on. Like in mysql front there is fasility to do that? i want to do with one botton in my app. it' to be like this :
1. i want to make list of the tables from database (in listbox)
2. i click the tables name in the list box.
3. there're an option in group box . like repair, check, optimize and soon
4. i hit the button to do those option and display the status in listbox to. like
table a reair...OK
table c reair...OK
table b reair...OK
etc
thank's
Posted: Mon 12 Mar 2007 08:04
by Antaeus
You can do this with the TMyServerControl component. It can analyze, check, optimize, repair tables and perform some other operations. For more information read the MyDAC Help documentation.
List of the tables in a database you can get by the GetTableNames method of the TMyConnection object.
Posted: Thu 26 Apr 2007 03:08
by putukaca
thank's for your replay
i can do with TMyServerControl but can u give me some example how to display the status of the table that i chose to analyze, check, optimize or repair like
table a optimize....ok
table b optimize....ok
etc..
nb: if u wish send to my email
[email protected]
thank's
yudi
Posted: Thu 26 Apr 2007 06:48
by Antaeus
TMyServerControl is a TDataSet descendant. It returns the result of the operation as a record set. The following code displays the result of the operation:
Code: Select all
Memo.Lines.Clear;
MyServerControl.TableNames := 'emp;dept';
MyServerControl.AnalyzeTable;
while not MyServerControl.Eof do begin
Memo.Lines.Add('Table ' + MyServerControl.FieldByName('Table').AsString + ' ' +
MyServerControl.FieldByName('Op').AsString + '...' +
MyServerControl.FieldByName('Msg_text').AsString);
MyServerControl.Next;
end;
Posted: Sun 29 Apr 2007 15:08
by putukaca
Memo.Lines.Add('Table ' + MyServerControl.FieldByName('Table').AsString + ' ' +
MyServerControl.FieldByName('Op').AsString + '...' +
MyServerControl.FieldByName('Msg_text').AsString);
sorry for asking again. when i compile i get an error [Error] tableService.pas(40): Undeclared identifier: 'FieldByName'. then i check the MyServerControl doesn't have property FieldByName. how to solve this? sorry because i'm new in delphi. please give me more explaination.
thank's
yudi
Posted: Thu 03 May 2007 08:20
by Antaeus
Please check that your MyServerControl variable is an object of the TMyServerControl class. If it is, move the MyServerControl unit to the first place in the uses clause. If this does not help, specify the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor.