-
Can anyone explain DBGrid. I mean how to connect it with the database, how to add field of the DataBase to particular column (and how to add two fields into the same column), and stuff like that. Thanks for all your help.
SLimak
------------------
Marek Karbarz
My WebPage
[email protected]
-
Let try the basic first. Dbgrid is bound to Data Control by the Datasource property of DBgrid.
To add fields and rows are do thur Data controls.
-
The easiest way (I think) of manipulating fields is to do it before they fill the Grid, in the RecordSource SQL statement, eg.
Data1.RecordSource = "SELECT FIELD4, FIELD2 + FIELD3, FIELD1 FROM TABLE1 ORDER BY FIELD1"
Data1.Refresh
This example would Pull back 3 Columns made up of the Fields in the Order Specified, Adding the Contents of Fields 2 & 3 to Make Column2 then Ordering all the Data by the Contents of Field1.
SQL - You Gotta Love It!!
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
SQL Gotta Love it? Try this example...
You have a database filled with artist and song titles. You want do select a certain song so you can just jump to that record to say edit it. This is the song in question.
Sniff 'n' The Tears - Driver's Seat.
No I didn't make that up. Since SQL uses the ' character, you have to convert to 2 '' which of course slows your program down if a USER is searching for the song... but does it work? No, Sniff ''n'' The Tears - Driver''s Seat will NOT work, nor will replacing them with " instead. Basically your only option is to change the field in the database to something else, and then the user can't find it because he won't know what to look for. That's precisely why my database app uses DAO and ADO... DAO is not DEPENDANT on SQL like ADO is.
If you know of a way to solve the '' or " problem, please - I'm all ears (eyes).