Hi mangakissa,
Actually I need the ODBCConnection.
What I'm doing is trying to write a procedure that puts filter buttons on each column of a DBGrid (a bit like in MS Excel/Access). I just want to pass the DBGrid as a parameter.
I'm trying to get small buttons in the column title row, but having difficulties, see
http://forum.lazarus.freepascal.org/index.php/topic,43711.0.html.
When the button is pressed it opens a Form with a few buttons (like set all, clear all, quite etc.) and a DBGrid with a Bookmarklist in Column 1 and the field where the button was pressed in the second column. I'm also having problems with Bookmarklist see
http://forum.lazarus.freepascal.org/index.php/topic,43713.0.html.
However, I've done a work around at the moment which works. The DBGrid in the opened window is fed with a SQLQuery which is pretty simple SELECT ColumnName FROM Table GROUP BY ColumnName.
However, the SQL needs the DB Connection that the main DBGrid is fed from.
I'm also trying to extract the Table name from the original DBGrid dataset, but this could be quite a task unless I keep the oringinal DBGrid query simple, SELECT * FROM Table; then I can get it from the SQL string in the DataSet in the passed DBGrid.
I'm probably making a mountain out of a molehill, but I am learning quite a bit as I'm doing this so enjoying it. I did ask if there was already some control which provided MS Excel/Access filter drop downs but haven't got any replies.
Dave