Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TClientDatabase

0 views
Skip to first unread message

BMitchell

unread,
Aug 3, 2006, 10:59:19 AM8/3/06
to

I am trying to use TClientDataset to create a temporary table for a grid. I only need the CDS for the life of the form and don't need to save it to any DB or file. I call the CDS.CreateDataset method, CDS.Open, then Insert add data then CDS.Post. But I can call CDS.RecordCount and the return value is always zero.

What are the little trick to get this to work. I just need to show some database in the grid but it is always blank cause the record count is always zero. Even right after a post.

Thank you.

Bill Todd

unread,
Aug 3, 2006, 12:36:34 PM8/3/06
to
You do not need to call Open after calling CreateDataSet but that
should not hurt anything. Show us the actual code.

--
Bill Todd (TeamB)

Loren Szendre

unread,
Aug 3, 2006, 12:30:51 PM8/3/06
to
BMitchell,

you seem to be following the right steps to use TClientDataset as a temp
table. It seems highly likely that the failure is the Insert. The Post
does not create a record. I have never seen RecordCount to fail on a
TClientDataset. If it says 0 records, there really are no records.

So, did you create "persistent" fields in the fields editor in design
time? What is your code from your Insert stmt thru your Post stmt?

Loren

BMitchell

unread,
Aug 3, 2006, 12:36:26 PM8/3/06
to

>So, did you create "persistent" fields in the fields editor in design
>time? What is your code from your Insert stmt thru your Post stmt?

I have the fields as persistent created at design time through the box by double clicking the compent.

I got it working by removing the indexes from the CDS. I don't know why I never got any errors but it is now working. I messed with so much stuff trying to get it to work that it could have been something else. But this was the last step I did when it started working.

Do you know of any reason for this?

Thank you

Bill Todd

unread,
Aug 3, 2006, 12:53:56 PM8/3/06
to
BMitchell wrote:

> Do you know of any reason for this?

No. If create the IndexDefs before you call CreateDataSet the indexes
should be created automatically and everything should work correctly.

--
Bill Todd (TeamB)

BMitchell

unread,
Aug 3, 2006, 2:32:49 PM8/3/06
to

>So, did you create "persistent" fields in the fields editor in design
>time? What is your code from your Insert stmt thru your Post stmt?

I have the fields as persistent created at design time through the box by double clicking the compent.

I got it working by removing the indexes from the CDS. I don't know why I never got any errors but it is now working. I messed with so much stuff trying to get it to work that it could have been something else. But this was the last step I did when it started working.

Do you know of any reason for this?

Thank you

Loren Szendre

unread,
Aug 3, 2006, 2:56:12 PM8/3/06
to
BMitchell,

my last thought on the subject is that you had a filter entered. You
should be able to insert records that do not meet the filter criteria,
but when you post them, they will "disappear".

Loren

0 new messages