ds.edit - access violation

Arvid

Member²
Hi,

I have the following code:

ds := TOracleDataset.Create(nil);
ds.Session := TOracleSession.Create(ds);
try
ds.ReadOnly := false;
ds.Session.LogonUsername := xxx
ds.Session.LogonPassword := xxx
ds.Session.LogonDatabase := xxx
ds.Session.LogOn;

ds.Active := false;
ds.SQL.Clear;
ds.SQL.Add('SELECT a.seksjon, a.parameter, a.verdi, a.sistendra, a.id, a.sletta, a.rowid FROM webuser.ewuelsoweinit a');
ds.SQL.Add('Where seksjon = '+QuotedStr(el.Seksjon)+' and parameter = '+QuotedStr(el.Parameter));
ds.SQL.Add('and id ='+QuotedStr(el.ID));
ds.Active := true;
if (ds.RecordCount = 1) then
ds.Edit;
....

I get Access violation at address 0040195D in module 'ElWSClient2.exe'. Read of address 0000ED2C

When the line "ds.Edit" is executed. Any idea why?
 
The problem "fixed itself".

I have not changed my code - but now it works.

What i did was to delete all data in the table in question - then I inserted the data again. I do not understand why - but it works now.
Could there have been some kind of lock in the database?
 
A lock is a normal situation that should nit lead to access violations when Edit is called (unless you have an event handler that causes the AV).

If this happens again, don't delete the data so that we can investigate. Or do you perhaps have a backup or export?
 
Back
Top