[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 966
  • Last Modified:

Connecting DBGrid with DataSource

Hi,
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 ?
Rgds,
Solveig
0
solhronn
Asked:
solhronn
  • 2
1 Solution
 
kretzschmarCommented:
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

Datamodule1.Datasource1

meikl ;-)
0
 
geobulCommented:
Hi,

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;

interface

uses
...., Unit2;

Then set:
DBGrid1.DataSource := DataModule1.DataSource1

Regards, Geo
0
 
kretzschmarCommented:
guessed a designtime solution was needed, not a runtime solution
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now