Hello.
I'm trying to develop a tiny database application in Delphi 6 but am somehow completely stuck
I'd like to have a form consisting of a TDBLookupComboBox and a ZDBGrid. The TZDBGrid is filled with values from a table in a database. I've did this by setting the ListSource property to a DataSource instance. In this DataSource, I've set the DataSet to a TZMySqlQuery which executes a very easy SQL query (SELECT id, text FROM Attribute). The LookupComboBox shows the values from »text« (it's the ListField) and uses the values from »id« as the DataField.
The TZDBGrids DataSource points to another DataSource on my form. It's dataset property then points to a TZMySqlQuery component having »Tbl« as the TableName. The table »Tbl« has a column »attribute_id« referencing the col. »id« from the table »Attribute«. So, »attribute_id« is a "foreign key" from the table »Attribute« - minus the fact that MySQL doesn't support foreign keys.
I'd like to accomplish, that the values in the grid change, depending on what I've chosen in the ComboBox. That in itself isn't that much of a problem, when I let the DataSet of the Grid's DataSource point to a TZMySqlQuery. However, I'd further like to be able to edit the values in the grid, and I don't see how I could do this, because when I change the DataSet to a TZMySqlQuery, the grid turns read-only
I'm rather sure that I'm doing something wrong - especially because I just started with developing database applications in Delphi. Well, I simply do not see what I'm missing or whatever.
How can I accomplish what I'm after and what are the "typical" steps to do when creating a database app in Delphi? Do I need to call the database editor? Or what?
Someone, please help!
Thanks a whole lot,
Alexander Skwar
I'm trying to develop a tiny database application in Delphi 6 but am somehow completely stuck
I'd like to have a form consisting of a TDBLookupComboBox and a ZDBGrid. The TZDBGrid is filled with values from a table in a database. I've did this by setting the ListSource property to a DataSource instance. In this DataSource, I've set the DataSet to a TZMySqlQuery which executes a very easy SQL query (SELECT id, text FROM Attribute). The LookupComboBox shows the values from »text« (it's the ListField) and uses the values from »id« as the DataField.
The TZDBGrids DataSource points to another DataSource on my form. It's dataset property then points to a TZMySqlQuery component having »Tbl« as the TableName. The table »Tbl« has a column »attribute_id« referencing the col. »id« from the table »Attribute«. So, »attribute_id« is a "foreign key" from the table »Attribute« - minus the fact that MySQL doesn't support foreign keys.
I'd like to accomplish, that the values in the grid change, depending on what I've chosen in the ComboBox. That in itself isn't that much of a problem, when I let the DataSet of the Grid's DataSource point to a TZMySqlQuery. However, I'd further like to be able to edit the values in the grid, and I don't see how I could do this, because when I change the DataSet to a TZMySqlQuery, the grid turns read-only
I'm rather sure that I'm doing something wrong - especially because I just started with developing database applications in Delphi. Well, I simply do not see what I'm missing or whatever.
How can I accomplish what I'm after and what are the "typical" steps to do when creating a database app in Delphi? Do I need to call the database editor? Or what?
Someone, please help!
Thanks a whole lot,
Alexander Skwar