Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 27 total
Thread Attempted to read or write protected memory. This is often an indication that ot
Wed, Feb 20 2008 8:16 AMPermanent Link

Hiba Hable
Hello,
I am using a dbisam odbc driver to connect to dbisam datatables from a vb.net application.
I am getting the following error:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
is that related to the dnisam driver, cuz i was trying the trial version of dbisam driver and there was no problem but when i installed the original version of the dbisam driver i got the error.
so is that related to the driver or something in the application!
Thank you.
Hiba
Wed, Feb 20 2008 8:53 AMPermanent Link

Hiba Hable
Hello,
btw i am not always gettin the error, i sometimes run my error w/o getting the error.
thx
Wed, Feb 20 2008 9:46 AMPermanent Link

"Frans van Daalen"

"Hiba Hable" <hiba_hable@hotmail.com> wrote in message
news:3215A1AA-F54D-47F5-92AC-3D21B6EC8F80@news.elevatesoft.com...
> Hello,
> btw i am not always gettin the error, i sometimes run my error w/o getting
> the error.
> thx
>

Are you using a index on recordid? If so please read the thread "ndex out of
bounds / index with recordid"
(http://www.elevatesoft.com/scripts/newsgrp.dll?action=openmsg&group=14&msg=1623&page=1)

Sorry for sending it to your email-account....

Wed, Feb 20 2008 11:14 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Hi Hiba,

Are you using dispose on the OdbcCommand etc. because if not this is
exactly the errors that you will get randomly

Chris Holland

Hiba Hable wrote:
> Hello,
> I am using a dbisam odbc driver to connect to dbisam datatables from a vb.net application.
> I am getting the following error:
> Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
> is that related to the dnisam driver, cuz i was trying the trial version of dbisam driver and there was no problem but when i installed the original version of the dbisam driver i got the error.
> so is that related to the driver or something in the application!
> Thank you.
> Hiba
>
Wed, Feb 20 2008 4:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Hiba,

<< I am using a dbisam odbc driver to connect to dbisam datatables from a
vb.net application. I am getting the following error:
Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.
is that related to the dnisam driver, cuz i was trying the trial version of
dbisam driver and there was no problem but when i installed the original
version of the dbisam driver i got the error.  >>

Chris is correct - you need to make sure that you're calling Dispose on any
connection or command objects when you're done using them, or else they will
get freed in the garbage collector thread and cause all sorts of problems.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Feb 21 2008 3:54 AMPermanent Link

Hiba Hable
Hello,
on the form closing, meaning when i am closing the whole application I did the following:
'sql connection
con.Close()
con.Dispose()
'dbisam odbc connection
odbccon.Close()
odbccon.Dispose()
// since i have 2 connections to 2 database one is sql and the other is dbisam.

but i am still facing the problem.
any idea?thx
Hiba
Thu, Feb 21 2008 4:25 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Hi Hiba,

It is not just the COnnection that you need to dispose but OdbcCommand
and OdbcDataAdapter as well.

You need something like the following:

Assuming you already have a Connection
.....
OdbcCommand TestCommand = new OdbcCommand("", TestConnection))
OdbcDataAdapter TestDA = new OdbcDataAdapter(TestCommand))

try
{
  DataSet TestDS = new DataSet())

  TestCommand.CommandText = "SELECT * FROM MyTable";
  TestDA.Fill(TestDS, "MyTable");

  etc..
}
catch(OdbcException oe)
{
}
finally
{
  TestDA.Dispose();
  TestCommand.Dispose();
}

C# has a special shortcut keyword which replaces the try .. finally
block called "using" and would make the code neater as follows:

using (OdbcCommand TestCommand = new OdbcCommand("", TestConnection))
{
  using (OdbcDataAdapter TestDA = new OdbcDataAdapter(TestCommand))
  {
    DataSet TestDS = new DataSet();

    TestCommand.CommandText = "SELECT * FROM MyTable";
    TestDA.Fill(TestDS, "MyTable");

    etc...
  }
}

Hope this helps

Chris Holland
SEC Solutions Ltd.
Sat, Feb 23 2008 5:13 AMPermanent Link

Hiba Hable
Hello,
it seems that sometimes i get the error and sometimes not!
I tried to use the keyword "using" on each adapter but where shall I dispose the adapters ? inside the using end using statment.
cuz when i am writing the dispose inside the using stmt , mu application exists alone with no error !
please any idea?
thx
Hiba
Sat, Feb 23 2008 2:39 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Hiba,

<< it seems that sometimes i get the error and sometimes not! >>

Then most likely you're still not handling the disposal properly.

<< I tried to use the keyword "using" on each adapter but where shall I
dispose the adapters ? inside the using end using statment. cuz when i am
writing the dispose inside the using stmt , mu application exists alone with
no error ! >>

See here for information on how the using statement works:

http://msdn2.microsoft.com/en-us/library/yh598w02(VS.80).aspx

It is basically the same thing as writing:

MyObject = new MyObjectClass();
try
  {
  // Do something with MyObject
  }
finally
  {
  MyObject.Dispose();
  }

except that the finally and the Dispose are implicit and happen
automatically for you.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Feb 25 2008 1:58 AMPermanent Link

Hiba Hable
Hello,
Do you that all what i need to write is the following:

Using adp As New OdbcDataAdapter(datasql, Constants.odbccon)
           adp.Fill(dtble)
End Using

and it should works, meaning that the dataadpater will be disposed after the endusing statment?
Thank you
Hiba
Page 1 of 3Next Page »
Jump to Page:  1 2 3
Image