TDAMemDataTable refresh issue

Hi,
My TdxDBTreeView’s dataset is using “SQL View” and FillWithDASql in TDAMemDataTable. When I use DACommand to update the record and using TDAMemDataTable.refresh, it will have the error message as below. I need to use “FillWithDASql” to refresh the records. Anything is wrong from me?
refresherror

I already set 'DynamicSelect" to true in server side and RemoteDataAdapter

Hi,

Does this field present in that table?
when you fill table with DASQL, it can contain fields from different tables.
when you do TDAMemDataTable.refresh it just close and open table with sql like

select * from tablename

where tablename = table.LogicalName

in case of DynamicSelect, it will be similar to

select field1, field2, ..., fieldN from tablename

Note: all these fields should be present in table.LogicalName table.

can you show your SQL that is used in DASQL?

is it something like

select ... 
from tablename 
[where ...] 
[order by ...]

?

if it like

select table1.field1, table2.field2 from table1, table2 where ...

it will generate error that you have.

Hi,
Here is my statement.

DASQL := ‘select * from V_Modules_EN order by ModuleFlag,PID,ModuleOrder’;

Hi,

can you check that the ModuleID field is present in the dbo.Modules table?

Hi,
ModuleID field is inside the View. Table is the other field name.
refresherror2

Hi,

it won’t work then.
you can use with DynamicSelect only fields that are present in table


if you change LogicalName from table to view, it will work

Hi,
Yes. It’s work after I changed LogicalName from table to view. Thanks!

What is the different if I paste StoredProcedure in “Tables” and “Command”? And I need to import the records from Excel that has over 20,000 rows. Any advise to handle in DA? Currently, I use VirtualTable to keep the records and then using crBatchMove component to insert the records to DB. This solution is slow.

Hi,

if your StoredProcedure returns select , you should drop it to tables, otherwise - to commands.

for this one-time operation you can use standard components without DA.
what components are you using for reading Excel and writing to DB ?

Hi,
I’m using SMImport suite to import Excel to VirtualTable.

Hi,

why you can’t use this SMImport suite and Direct Access Component for writing these excel records to DB?

Hi,
Because it has some operation procedure need to doing by user. After that, user will click the save and records will insert into DB.

If using the VirtualTable first, then the performance will better than direct to import the db. If the file information has problem, then user need to generate the excel again and import again.

Hi,

usual steps:

  • convert excel to TDataset compatible
  • [optionally] send data from server-side to client-side.
  • user should approve
  • send data to server and add to DB

because you don’t want to use native DA components (memtable, etc), you can prepare stream with data on client-side and send it to server via custom method.
on server-side you can read data back and insert to DB using DAC.

Note: inserting 20k records will be not faster operation

Thanks for your advise. :pray: