HighTechTalks DotNet Forums  

Unhandled exception

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Unhandled exception in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
nyoussef
 
Posts: n/a

Default Unhandled exception - 12-31-2007 , 09:13 AM






When I run below sample code I get the error message "attempted to read write
protected memory. This is often an indication that other memory is corrupt"
if the records reteived from the DB exceeds 300 or 400 records:

'VB libraries
Imports EX_MaDll

'System libraries
Imports System.IO
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Data.OracleClient

Public Class frm_EOD

(Truncated code)

Private Sub But_EncBills_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles But_EncBills.Click

(...Declaration)

ORC_Command1.CommandText = "SELECT BILL_NO
AS BILL_NO, CASE WHEN signature IS NULL THEN 'NULL'
ELSE signature END AS BILL_SIG, bill_amount
AS BILL_AMNT, CASE WHEN RUN_DATE IS NULL THEN 'NULL'
ELSE RUN_DATE END AS RUN_DATE, CASE WHEN key_ref IS NULL THEN 'NULL'
ELSE key_ref END AS KEY_REF, create_date
AS CREATE_DATE, drawee_Acct_no
AS RIB_TIRE FROM (SELECT BILL_NO, signature,
bill_amount, " & _
" RUN_DATE, " & _
" key_ref, " & _
" create_date, " & _
" drawee_Acct_no, rownum as NUMERO " & _
"FROM V_OUT_BILL " & _
"WHERE CODE_VALUE = 41)

ORC_Command1.Connection = db_Oracle_Conn
ORC_Command1.CommandType = CommandType.Text
Rs_Orc1 = ORC_Command1.ExecuteReader

While Rs_Orc1.Read()
Dim f_AuthentiferSignerLDC As New EX_MaDll.clsSub
ResignResult =
f_AuthentiferSignerLDC.AuthentifierSignerLDC(Path_ Past_Key_Loop,
Path_Current_Key, Path_Local_CatPak + Bill_Num, Path_Local_CatPak + Bill_Num)
End While
Rs_Orc1.Close()
End Sub



Reply With Quote
  #2  
Old   
Scott M.
 
Posts: n/a

Default Re: Unhandled exception - 12-31-2007 , 11:37 AM






Try not creating a new instance of EX_MaDll.clsSub in your while loop.
Instead declare & instantiate f_AuthentiferSignerLDC prior to the loop and
then just assign the variable in the loop.


"nyoussef" <nyoussef (AT) discussions (DOT) microsoft.com> wrote

Quote:
When I run below sample code I get the error message "attempted to read
write
protected memory. This is often an indication that other memory is
corrupt"
if the records reteived from the DB exceeds 300 or 400 records:

'VB libraries
Imports EX_MaDll

'System libraries
Imports System.IO
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Data.OracleClient

Public Class frm_EOD

(Truncated code)

Private Sub But_EncBills_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles But_EncBills.Click

(...Declaration)

ORC_Command1.CommandText = "SELECT BILL_NO
AS BILL_NO, CASE WHEN signature IS NULL THEN 'NULL'
ELSE signature END AS BILL_SIG, bill_amount
AS BILL_AMNT, CASE WHEN RUN_DATE IS NULL THEN 'NULL'
ELSE RUN_DATE END AS RUN_DATE, CASE WHEN key_ref IS NULL THEN
'NULL'
ELSE key_ref END AS KEY_REF, create_date
AS CREATE_DATE, drawee_Acct_no
AS RIB_TIRE FROM (SELECT BILL_NO, signature,
bill_amount, " & _
" RUN_DATE, " & _
" key_ref, " & _
" create_date, " & _
" drawee_Acct_no, rownum as NUMERO " & _
"FROM V_OUT_BILL " & _
"WHERE CODE_VALUE = 41)

ORC_Command1.Connection = db_Oracle_Conn
ORC_Command1.CommandType = CommandType.Text
Rs_Orc1 = ORC_Command1.ExecuteReader

While Rs_Orc1.Read()
Dim f_AuthentiferSignerLDC As New EX_MaDll.clsSub
ResignResult =
f_AuthentiferSignerLDC.AuthentifierSignerLDC(Path_ Past_Key_Loop,
Path_Current_Key, Path_Local_CatPak + Bill_Num, Path_Local_CatPak +
Bill_Num)
End While
Rs_Orc1.Close()
End Sub





Reply With Quote
  #3  
Old   
nyoussef
 
Posts: n/a

Default Re: Unhandled exception - 01-02-2008 , 01:34 AM



I already tried this solution with some result.

"Scott M." wrote:

Quote:
Try not creating a new instance of EX_MaDll.clsSub in your while loop.
Instead declare & instantiate f_AuthentiferSignerLDC prior to the loop and
then just assign the variable in the loop.


"nyoussef" <nyoussef (AT) discussions (DOT) microsoft.com> wrote in message
news:28D4F5C5-63A3-433D-BB06-796AF3D536C8 (AT) microsoft (DOT) com...
When I run below sample code I get the error message "attempted to read
write
protected memory. This is often an indication that other memory is
corrupt"
if the records reteived from the DB exceeds 300 or 400 records:

'VB libraries
Imports EX_MaDll

'System libraries
Imports System.IO
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Data.OracleClient

Public Class frm_EOD

(Truncated code)

Private Sub But_EncBills_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles But_EncBills.Click

(...Declaration)

ORC_Command1.CommandText = "SELECT BILL_NO
AS BILL_NO, CASE WHEN signature IS NULL THEN 'NULL'
ELSE signature END AS BILL_SIG, bill_amount
AS BILL_AMNT, CASE WHEN RUN_DATE IS NULL THEN 'NULL'
ELSE RUN_DATE END AS RUN_DATE, CASE WHEN key_ref IS NULL THEN
'NULL'
ELSE key_ref END AS KEY_REF, create_date
AS CREATE_DATE, drawee_Acct_no
AS RIB_TIRE FROM (SELECT BILL_NO, signature,
bill_amount, " & _
" RUN_DATE, " & _
" key_ref, " & _
" create_date, " & _
" drawee_Acct_no, rownum as NUMERO " & _
"FROM V_OUT_BILL " & _
"WHERE CODE_VALUE = 41)

ORC_Command1.Connection = db_Oracle_Conn
ORC_Command1.CommandType = CommandType.Text
Rs_Orc1 = ORC_Command1.ExecuteReader

While Rs_Orc1.Read()
Dim f_AuthentiferSignerLDC As New EX_MaDll.clsSub
ResignResult =
f_AuthentiferSignerLDC.AuthentifierSignerLDC(Path_ Past_Key_Loop,
Path_Current_Key, Path_Local_CatPak + Bill_Num, Path_Local_CatPak +
Bill_Num)
End While
Rs_Orc1.Close()
End Sub






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.