Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Unbound Dataset?
Tue, Oct 2 2018 10:22 PMPermanent Link

Mario Enríquez

Open Consult

Hi folks,

I'm attempting to use a TDataset to hold some temporary values and have it shown in a TGrid.

I've define the Dataset structure at design time and then use the following code to fill it with data:

  dstClasificaciones.Close;
  dstClasificaciones.Open;
  for i := 0 to TotalClasificaciones -1 do
  begin
     cl := TmdsClasificacion(glbClasificaciones.Items[i]);
     dstClasificaciones.Insert(True);
     dstClasificaciones.Columns['id_clasificacion'].AsString := cl.id_clasificacion;
     dstClasificaciones.Columns['clasificacion'].AsString := cl.clasificacion;
     dstClasificaciones.Save;
  end;

The procedure is completed and the data get loaded, but I get an Application Error "Uncaught Error: Database commit response error", as it is trying to access and underlaying resource at the webserver that it not there. (http://localhost:80/databases?method=commit&;database=Default")

I tried looking at the obvious places (to me..) on how to disable it and have it run without errors.

Any idea on what I'm might be missing?

Regards,
Mario
Tue, Oct 2 2018 11:15 PMPermanent Link

ooptimum

I guess the AutoTransactions property of your default database is True, so it's trying to commit transaction upon you call Save method, while the dataset is virtual.
Wed, Oct 3 2018 12:02 AMPermanent Link

Mario Enríquez

Open Consult

Thank you ooptimum, you nail it.

Just added the following line, right before Open, and problem solved.

dstClasificaciones.OwnerDatabase.AutoTransactions := False;


Regards,
Mario
Image