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

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
invent
Posts: 92
Joined: Tue 16 Jun 2009 10:59
Location: Bielefeld, Germany

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

Post by invent » Mon 13 Dec 2010 19:59

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

AndreyZ

Post by AndreyZ » Tue 14 Dec 2010 15:03

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;

Post Reply