Click here to Skip to main content
15,905,590 members
Home / Discussions / C#
   

C#

 
AnswerRe: AccessViolationException in OdbcDataReader Pin
OriginalGriff16-Aug-09 22:10
mveOriginalGriff16-Aug-09 22:10 
GeneralRe: AccessViolationException in OdbcDataReader Pin
Luc Pattyn16-Aug-09 23:54
sitebuilderLuc Pattyn16-Aug-09 23:54 
GeneralRe: AccessViolationException in OdbcDataReader Pin
OriginalGriff17-Aug-09 0:37
mveOriginalGriff17-Aug-09 0:37 
AnswerRe: AccessViolationException in OdbcDataReader Pin
Hristo-Bojilov16-Aug-09 22:11
Hristo-Bojilov16-Aug-09 22:11 
GeneralRe: AccessViolationException in OdbcDataReader Pin
Frozzeg16-Aug-09 22:26
Frozzeg16-Aug-09 22:26 
GeneralRe: AccessViolationException in OdbcDataReader Pin
Christian Graus16-Aug-09 22:30
protectorChristian Graus16-Aug-09 22:30 
GeneralRe: AccessViolationException in OdbcDataReader Pin
Frozzeg16-Aug-09 22:45
Frozzeg16-Aug-09 22:45 
GeneralRe: AccessViolationException in OdbcDataReader [modified] Pin
Saksida Bojan16-Aug-09 22:57
Saksida Bojan16-Aug-09 22:57 
Yes that is true, you get expection when accsess an index that doesn't exsist.

If you have 3 indexes.
for (int i=0; i<=index+1;i++)

first part: i<=index. when you count 3, loop will do extra loop because of '<=' will do extra loop till i gets to 3. but it is zero based index and if i gets to 3, there are 4 indexes already, while reader have only 3. The second part is +1. Lose it. if you wan't to keep <= then use instead index+1 use index-1

edit: Also all exceptions comes with description, probably yours came with "Index out of boundary". When you wan't to know what is wrong,sometimes it is not enough the place and witch expection. All exceptions comes with a message

Frozzeg wrote:
In the first message, I pointed to a code string with an error

You only pointed where AccessViolationException happens

edit 2: Copy paste from MSDN

Remarks
An access violation occurs in unmanaged or unsafe code when the code attempts to read or write to memory that has not been allocated, or to which it does not have access. This usually occurs because a pointer has a bad value. Not all reads or writes through bad pointers lead to access violations, so an access violation usually indicates that several reads or writes have occurred through bad pointers, and that memory might be corrupted. Thus, access violations almost always indicate serious programming errors. In the .NET Framework version 2.0, an AccessViolationException clearly identifies these serious errors.

In programs consisting entirely of verifiable managed code, all references are either valid or null, and access violations are impossible. An AccessViolationException occurs only when verifiable managed code interacts with unmanaged code or with unsafe managed code.

Version Information
This exception is new in the .NET Framework version 2.0. In earlier versions of the .NET Framework, an access violation in unmanaged code or unsafe managed code is represented by a NullReferenceException in managed code. A NullReferenceException is also thrown when a null reference is dereferenced in verifiable managed code, an occurrence that does not involve data corruption, and there is no way to distinguish between the two situations in versions 1.0 or 1.1.

modified on Monday, August 17, 2009 5:09 AM

AnswerRe: AccessViolationException in OdbcDataReader Pin
Christian Graus16-Aug-09 22:29
protectorChristian Graus16-Aug-09 22:29 
AnswerRe: AccessViolationException in OdbcDataReader Pin
Frozzeg16-Aug-09 23:12
Frozzeg16-Aug-09 23:12 
GeneralRe: AccessViolationException in OdbcDataReader Pin
Saksida Bojan16-Aug-09 23:15
Saksida Bojan16-Aug-09 23:15 
GeneralRe: AccessViolationException in OdbcDataReader Pin
Frozzeg16-Aug-09 23:27
Frozzeg16-Aug-09 23:27 
GeneralRe: AccessViolationException in OdbcDataReader Pin
Saksida Bojan16-Aug-09 23:50
Saksida Bojan16-Aug-09 23:50 
GeneralRe: AccessViolationException in OdbcDataReader Pin
Frozzeg17-Aug-09 0:01
Frozzeg17-Aug-09 0:01 
AnswerRe: AccessViolationException in OdbcDataReader Pin
Singan17-Aug-09 5:01
Singan17-Aug-09 5:01 
Questionread data from a sql database on server from client ??? Pin
mr.mohsen16-Aug-09 20:35
mr.mohsen16-Aug-09 20:35 
AnswerRe: read data from a sql database on server from client ??? Pin
padmanabhan N16-Aug-09 20:39
padmanabhan N16-Aug-09 20:39 
GeneralRe: read data from a sql database on server from client ??? Pin
mr.mohsen16-Aug-09 20:47
mr.mohsen16-Aug-09 20:47 
AnswerRe: read data from a sql database on server from client ??? Pin
Saksida Bojan16-Aug-09 20:43
Saksida Bojan16-Aug-09 20:43 
Questionhow to retrive bookmarks from word document in c#.net Pin
Veerendranadh16-Aug-09 20:27
Veerendranadh16-Aug-09 20:27 
AnswerRe: how to retrive bookmarks from word document in c#.net Pin
padmanabhan N16-Aug-09 20:48
padmanabhan N16-Aug-09 20:48 
QuestionIndex Services Erros(The query contained only ignored words) Pin
alisolution16-Aug-09 20:21
alisolution16-Aug-09 20:21 
AnswerRe: Index Services Erros(The query contained only ignored words) Pin
Hristo-Bojilov16-Aug-09 21:40
Hristo-Bojilov16-Aug-09 21:40 
QuestionOn Line Chat Pin
GauravGupta21216-Aug-09 20:07
GauravGupta21216-Aug-09 20:07 
AnswerRe: On Line Chat Pin
Christian Graus16-Aug-09 20:22
protectorChristian Graus16-Aug-09 20:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.