Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBEXPRESS - How to show records using a SQLQUERY in a DBGRID?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
DBEXPRESS - How to show records using a SQLQUERY in a DBGRID?

I associate dataset to a sqlquery then dbgrid to dataset, this will give an error.
If I associate to dataset the SQLClientDataSet there are no problem, it works.
Why I can associate a SQLQUERY to DBGRID?
 
I think DBExpress datasets have a forward-only cursor so you can't attach them to a DBGrid. If you attach it to a client dataset then the query contents are traversed and entered into the client dataset and you can go forward and backward (which is necessary for a dbgrid).

Hope that makes sense :)

TealWren
 
Add a datacontrol and a dbgrid to your Form.Connect the datacontrol to your database.
Set the datacontrol as the datasource for your dbgrid.
For the recordset property of the datacontrol, type your SQL statement.

Example:

Dim sql as String

sql = "Select * From tblMyTable"
datacontrol.recordset = sql
datacontrol.recordset.refresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top