Connecting DBGrid with DataSource

Posted on 2004-11-25
Last Modified: 2010-05-18
How do I connect my DBGrid with my DataSource? I'm connecting to a Oracle Database with ADOTable and DataSource in a DataModule but have the DB Grid on a seperate Form. When I set DataSource, in the DBGrid, to ADOTable1 with the Object Inspector I get "Invalid property value".
Can't I keep ADOTable1 and DataSource1 on the DataModule1 ?
Question by:solhronn
    LVL 27

    Expert Comment

    u must include your datamodule-unit into your uses clause of your form, where the grid resides

    after this an entry should be selectable and/or typeable like


    meikl ;-)
    LVL 17

    Accepted Solution


    1. In your DataModule1:
    DataSource1.DataSet := ADOTable1;

    2. In your form where DBGrid1 is:

    If Form1 is in Unit1 and DataModule1 is in Unit2, for example, then add it to the uses clause of the unit1:

    unit Unit1;


    ...., Unit2;

    Then set:
    DBGrid1.DataSource := DataModule1.DataSource1

    Regards, Geo
    LVL 27

    Expert Comment

    guessed a designtime solution was needed, not a runtime solution

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now