RTC Forums
November 24, 2024, 01:30:35 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
Clone TrtcDataSet or TRtcMemDataSet from TQuery without data
Pages: [
1
]
« previous
next »
Print
Author
Topic: Clone TrtcDataSet or TRtcMemDataSet from TQuery without data (Read 4941 times)
Theprasit
RTC License++
Posts: 42
Clone TrtcDataSet or TRtcMemDataSet from TQuery without data
«
on:
July 04, 2013, 07:50:44 PM »
Hi,
I use rtcDB.DelphiDataSetTortc() to clone from TQuery but I need only structure (no data). I'm looking for something like EmptyDataSet or ClearData method.
Any advise.
Regards,
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Clone TrtcDataSet or TRtcMemDataSet from TQuery without data
«
Reply #1 on:
July 04, 2013, 08:18:27 PM »
The solution is simple. Copy the DelphiDataSetToRtc function from the rtcDB unit to your own unit, give it another name, and then make any changes you want/need (like copying only field structure without data, or adding support for other field types). DelphiDataSetToRtc and RtcDataSetToDelphi functions in the rtcDB unit are only examples. You will need to make your own version of these functions if you want to make full use of all types supported by your Database Engine.
Best Regards,
Danijel Tkalcec
Logged
Theprasit
RTC License++
Posts: 42
Re: Clone TrtcDataSet or TRtcMemDataSet from TQuery without data
«
Reply #2 on:
July 04, 2013, 08:38:18 PM »
Sorry, for missing something.
Normally, I need to call SQL like (Select * From MyTable Where 1=2) and clone it as empty table for another transaction processing. I tried DelphiDataSetToRtc but the output is a blank MemDataSet with only one column.
Unfortunately, I found the solution like this:-
- Call SQL
- use DelphiDataSetToRtc(SQL, Result.NewDataSet)
- client side: use RtcMemDataSet.asDataSet:= Result.asDataSet;
This work as expected.
I notice that using RtcMemDataSet.Close or RtcMemDataSet.Active:= False will clear all both Data and Structure. Is this by-design?
Best Regards,
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Clone TrtcDataSet or TRtcMemDataSet from TQuery without data
«
Reply #3 on:
July 04, 2013, 09:20:09 PM »
Yes, this is by design.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...