1

My code :

if dataset.IsEmpty then 
  DoSomething(x);

When 'if dataset.IsEmpty' runs l get the following error: 'Access violation at address xxxxxxxxx in module abc'

Why am I getting this error? I don't know the explanation of 'access violation' - can someone please explain this to me and help me avoid this error.

Thank you.

Vector
  • 10,879
  • 12
  • 61
  • 101
boy
  • 11
  • 1
  • 2
  • 2
    Check if the dataset is pointing to a valid memory address try something like this `if Assigned(dataset) then` – RRUZ Aug 02 '11 at 03:01
  • 2
    Why did you obfuscate the error message? What made you think that giving less information would help us answer? Give us the whole message please! In particular I want the bit that says either "read of address" or "write of address" and I want both addresses. – David Heffernan Aug 02 '11 at 07:19

2 Answers2

1

it can be because the dataset is inactive/closed when you try to access it.

1

See here for an explanation on AV exceptions and how to debug them. The solution could be as simple as checking if dataset is assigned, as RRUZ suggests, but we would never know with this little information. Showing us the exact error message will help to rule out some cases.

Community
  • 1
  • 1
Lars Truijens
  • 42,837
  • 6
  • 126
  • 143