Results 1 to 4 of 4

Thread: DBGrid Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Location
    Northampton, MA
    Posts
    10

    Post

    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]

  2. #2
    Addicted Member
    Join Date
    Apr 1999
    Location
    Freeport
    Posts
    204

    Post

    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.

  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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]

  4. #4
    New Member
    Join Date
    Jul 1999
    Posts
    5

    Post

    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).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width