0

Ive searched on this error plenty, and have tried all the fixes i found.

Im making a document management system. And i have no prior vb experience, just figuring it out as i go. I have run into this problem now and i have no idea what the heck to do to fix it. I have narrowed it down to whats causing it but again not sure how i would change the root to solve the problem.

I have a showdialog that allows for documents to be added to the system. This works perfectly as long as i dont do any sql on the access database. As soon as I run a command on the access database (eg cmd.ExecuteNonQuery() or Dim da As New OleDbDataAdapter(StrSQL, cnn)
da.Fill(ds, TableName) dt = ds.Tables(TableName)
) the program will error on showdialog and give me this error

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Ive tried recreating the form, i havnt yet tried reinstalling visual studio as it didnt make any difference in all the posts ive read, ive tried to recode the showdialog as well as the sql parts with no difference, ive changed compiler settings and set my .net framework to 4 (not client profile).

Nothing seems to work. Any help would be much appreciated thanks.

I can provide code if neccessary although im sure its quite ugly :)

NickS
  • 23
  • 5

1 Answers1

0

That error is a strange one to get in VB.NET. It is more common in C# or unmanaged languages.

I can't tell you how to fix it but I can give you some pointers:

  • What version of .NET are you using? If it is not 2010 then try upgrading to this (you can compile your application to use a different framework if you need to)

  • Make sure you have all MS updates installed for Visual Studio. There were some fixes that addressed this error

  • Turn Option Strict On (not sure this will fix you issue but good practise anyway) and fix any resulting errors

  • It is not the ShowDialog that is causing the error, visual studio is just breaking at this point. Try setting a breakpoint on ShowDialog and step through your code using the F8 key to see exactly where the error occurs. That might give you more clues

Matt Wilko
  • 26,994
  • 10
  • 93
  • 143
  • Thanks for the reply Matt Im busy getting an upgrade to 2012 see if that helps then. Ill try getting all the updates as well. I have put a breakpoint on showdialog a few times :) but the error only occurs when it tries to run that line of code, so im not sure how to check whats breaking there...the immediate window? – NickS Aug 16 '12 at 12:10
  • Hey @Matt Wilko --- I have installed 2012 VS now with all hotfixes and am using option strict as suggested. Updating the version didnt make any difference at all sadly. Do you think using a SQL database instead of an access one would make a difference? Else do you know of another way to get a file select dialog up? --- Thanks again – NickS Aug 17 '12 at 09:43