The code breaks on line number 55. Please help. I did search on google but did not get a clear answer. hoping on this forum someone will give me a clue how I can fix this.
thanks
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source Error: the code breaks on line nubmer 55
Line 55: adAddenda.Fill(dsAddenda, "AddendaList")
Line 53:
Line 54: 'fill the dataset with the result of our query from the specified command
Line 55: adAddenda.Fill(dsAddenda, "AddendaList")
Line 56:
Line 57: 'Bind the DataSet to the GridView
---------------------------
my code
Imports System.Data
Imports System.Data.OracleClient
Imports System.Configuration.ConfigurationManager
Partial Class addtest
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BindData()
End If
'.Append("ANd pr.pjprjnum <> '5703-42 / HSIP 5707(007)'"
End Sub
Sub BindData()
Dim srtOrder As String = SortList1.SelectedValue
Dim drDirection As String = DirectionList.SelectedValue
'Dim oOracleConn As OracleConnection
Dim connectionString As String = ConnectionStrings("ConnectionString").ConnectionString
Dim oOracleConn As OracleConnection = New OracleConnection(connectionString)
Dim strStringBuilder As StringBuilder
strStringBuilder = New StringBuilder
With strStringBuilder
.Append(" SELECT DISTINCT p.cprojnum, p.cprojnum || NVL2 (TRIM (p.prroute), '(' || p.prroute || ')', NULL) AS stateproject, ")
.Append(" TRIM (SUBSTR (pr.pjprjnum, INSTR (pr.pjprjnum, '/') + 1) ) AS minnesotaprojectnumber, ")
.Append(" a.contid, LTRIM (a.addend, 0) addendanum, TO_CHAR (a.dateadd, 'MM/DD/YYYY') AS dateadded, (a.adescr) as Descr, ")
.Append(" substr(l.letting,3,2)||'-'|| substr(l.letting,5,2)||'-'|| substr(l.letting,1,2)Lett_date ")
.Append(" FROM addend a, letprop l, proposal p, propproj pp, project pr ")
.Append(" WHERE a.contid = p.contid AND pp.contid = p.contid AND pp.pcn = pr.pcn AND l.lcontid = p.contid ")
.Append(" AND (l.letting = '08062701') AND INSTR (pr.pjprjnum, p.cprojnum) > 0 ")
.Append(" GROUP BY a.addend,a.dateadd, a.contid,l.letting, p.cprojnum,p.prroute, a.adescr, pjprjnum ")
.Append(" ORDER BY " & srtOrder & " " & drDirection)
End With
'create a new command and pass our sql statement and our connection object.
Dim cmdAddenda As New OracleCommand()
' Dim cmdAddenda As New OleDbCommand()
cmdAddenda.Connection = oOracleConn
cmdAddenda.CommandType = CommandType.Text
cmdAddenda.CommandText = strStringBuilder.ToString
'open the connection
'oOracleConn.Open()
'create a new sqladapter and set its command object with our sqlcommand
Dim adAddenda As New OracleDataAdapter(cmdAddenda)
'create a new dataset to hold our data
Dim dsAddenda As New DataSet
'fill the dataset with the result of our query from the specified command
adAddenda.Fill(dsAddenda, "AddendaList")
'Bind the DataSet to the GridView
gvaddenda.DataSource = dsAddenda
gvaddenda.DataBind()
'Close the connection
oOracleConn.Close()
lblTotal.Text = dsAddenda.Tables("AddendaList").Rows.Count.ToString
If lblTotal.Text = "0" Then
SortList1.Visible = False
DirectionList.Visible = False
Button1.Visible = False
lblSrt.Visible = False
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
BindData()
End Sub
End Class
thanks
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source Error: the code breaks on line nubmer 55
Line 55: adAddenda.Fill(dsAddenda, "AddendaList")
Line 53:
Line 54: 'fill the dataset with the result of our query from the specified command
Line 55: adAddenda.Fill(dsAddenda, "AddendaList")
Line 56:
Line 57: 'Bind the DataSet to the GridView
---------------------------
my code
Imports System.Data
Imports System.Data.OracleClient
Imports System.Configuration.ConfigurationManager
Partial Class addtest
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BindData()
End If
'.Append("ANd pr.pjprjnum <> '5703-42 / HSIP 5707(007)'"
End Sub
Sub BindData()
Dim srtOrder As String = SortList1.SelectedValue
Dim drDirection As String = DirectionList.SelectedValue
'Dim oOracleConn As OracleConnection
Dim connectionString As String = ConnectionStrings("ConnectionString").ConnectionString
Dim oOracleConn As OracleConnection = New OracleConnection(connectionString)
Dim strStringBuilder As StringBuilder
strStringBuilder = New StringBuilder
With strStringBuilder
.Append(" SELECT DISTINCT p.cprojnum, p.cprojnum || NVL2 (TRIM (p.prroute), '(' || p.prroute || ')', NULL) AS stateproject, ")
.Append(" TRIM (SUBSTR (pr.pjprjnum, INSTR (pr.pjprjnum, '/') + 1) ) AS minnesotaprojectnumber, ")
.Append(" a.contid, LTRIM (a.addend, 0) addendanum, TO_CHAR (a.dateadd, 'MM/DD/YYYY') AS dateadded, (a.adescr) as Descr, ")
.Append(" substr(l.letting,3,2)||'-'|| substr(l.letting,5,2)||'-'|| substr(l.letting,1,2)Lett_date ")
.Append(" FROM addend a, letprop l, proposal p, propproj pp, project pr ")
.Append(" WHERE a.contid = p.contid AND pp.contid = p.contid AND pp.pcn = pr.pcn AND l.lcontid = p.contid ")
.Append(" AND (l.letting = '08062701') AND INSTR (pr.pjprjnum, p.cprojnum) > 0 ")
.Append(" GROUP BY a.addend,a.dateadd, a.contid,l.letting, p.cprojnum,p.prroute, a.adescr, pjprjnum ")
.Append(" ORDER BY " & srtOrder & " " & drDirection)
End With
'create a new command and pass our sql statement and our connection object.
Dim cmdAddenda As New OracleCommand()
' Dim cmdAddenda As New OleDbCommand()
cmdAddenda.Connection = oOracleConn
cmdAddenda.CommandType = CommandType.Text
cmdAddenda.CommandText = strStringBuilder.ToString
'open the connection
'oOracleConn.Open()
'create a new sqladapter and set its command object with our sqlcommand
Dim adAddenda As New OracleDataAdapter(cmdAddenda)
'create a new dataset to hold our data
Dim dsAddenda As New DataSet
'fill the dataset with the result of our query from the specified command
adAddenda.Fill(dsAddenda, "AddendaList")
'Bind the DataSet to the GridView
gvaddenda.DataSource = dsAddenda
gvaddenda.DataBind()
'Close the connection
oOracleConn.Close()
lblTotal.Text = dsAddenda.Tables("AddendaList").Rows.Count.ToString
If lblTotal.Text = "0" Then
SortList1.Visible = False
DirectionList.Visible = False
Button1.Visible = False
lblSrt.Visible = False
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
BindData()
End Sub
End Class