Page 1 of 1

Still problems with Sql-Server. What's the best way??

Posted: Mon 13 Dec 2010 19:59
by invent
Hi,

after the performance-problems in http://www.devart.com/forums/viewtopic.php?t=19680 I set

in TUniConnection: SQL Server.MultipleActiveResultSets=True
and in TUniTable: SQL Server.FetchAll=False

Than everything is fast, but there is NO WAY to edit the table-rows.

I'm not amused, because this information was important before I changed 6000 components in 1700 files.

Okay, what can I do?

1. Edit one record. I think the best way is:
MyUniTable.FilterSQL := '...';
MyUniTable.Open;
MyUniTable.Edit;

2. How to insert a record? My code is
MyUniTable.Open;
MyUniTable.Insert;

This way is too slow, because Open takes 30-50 seconds.

How to filter the dataset before insert?

Kind regards,
Gerd Brinkmann
invent GmbH

Posted: Tue 14 Dec 2010 15:03
by AndreyZ
Hello,
Than everything is fast, but there is NO WAY to edit the table-rows.
To edit table rows you should also set the TUniTable.LockMode property to lmNone.

To insert or edit one record it is better to use TUniQuery component. Here is an example on record inserting:

Code: Select all

  UniQuery.SQL.Text := 'insert into test(id, str) values(:id, :str)';
  UniQuery.ParamByName('id').AsInteger := 1;
  UniQuery.ParamByName('str').AsString := 'test1';
  UniQuery.Execute;
and here is an example on record editing:

Code: Select all

  UniQuery.SQL.Text := 'update test set str=:str where id=:id';
  UniQuery.ParamByName('str').AsString := 'test2';
  UniQuery.ParamByName('id').AsInteger := 1;
  UniQuery.Execute;