Help to newbie with delphi & mysql & mydac data fetch
Posted: Thu 19 Apr 2007 13:17
Hi
I'm a old VB programmer, but now I have to move into Delphi, but it brings lots of problems, like converting old VB code into new delphi one. I have discovered many things by myself, but one thing with database handling is mystery, how it is done in Delphi with MyDac.
See, I have this old VB&ADO code that can access datatable fields by their name.
First I get some info -> rs.open "Select * from Table;"
Then I get access to that info -> var = rs![FieldAny]
but the point is, that I need to access that table by its name, not with some kind of index, because it is very ugly debug-show, if there is billion lines of code, and I add new field into table, then indexes may go wrong! DB 99% probably updates during program lifetime.
I want this kind of thing to work : ShowMessage(frmImport.MyQuery1.Fields['AnyField'].AsString);
Not THIS
ShowMessage(frmImport.MyQuery1.Fields[0].AsString);
All I have discovered this far, that I cannot call info with field name, but just with index... and that is not acceptable.
Can you help?
I'm a old VB programmer, but now I have to move into Delphi, but it brings lots of problems, like converting old VB code into new delphi one. I have discovered many things by myself, but one thing with database handling is mystery, how it is done in Delphi with MyDac.
See, I have this old VB&ADO code that can access datatable fields by their name.
First I get some info -> rs.open "Select * from Table;"
Then I get access to that info -> var = rs![FieldAny]
but the point is, that I need to access that table by its name, not with some kind of index, because it is very ugly debug-show, if there is billion lines of code, and I add new field into table, then indexes may go wrong! DB 99% probably updates during program lifetime.
I want this kind of thing to work : ShowMessage(frmImport.MyQuery1.Fields['AnyField'].AsString);
Not THIS
ShowMessage(frmImport.MyQuery1.Fields[0].AsString);
All I have discovered this far, that I cannot call info with field name, but just with index... and that is not acceptable.
Can you help?