G
Guest
Hi Everyone,
This is a first for me. I'm getting this error:
Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.
This happens when the dataAdapter tries to fill the dataset. This is the
only place in my code that this happens. This is the only function that this
happens. The code is below:
Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim cmd As New OleDbCommand
Dim sql As String
Dim ds As New dataset
Dim da as new OleDbDataAdapter
sql = "SELECT ClientMessages.MessageId, ClientMessages.EffectiveDate,
ClientMessages.Message, ClientMessages.WhoFor,"
sql = sql & "ClientMessages.Acknowledged, PATIENT.LastName + ', ' +
PATIENT.FirstName as ClientName "
sql = sql & "FROM ClientMessages LEFT JOIN PATIENT ON
ClientMessages.PatientId = PATIENT.PatientID "
sql = sql & "Where ClientMessages.EffectiveDate <= #" &
now.ToShortDateString & "# And ClientMessages.Acknowledged = 0 "
sql = sql & "And ClientMessages.PatientId = '" & "529195929" & "' "
sql = sql & "ORDER BY ClientMessages.EffectiveDate"
cmd.CommandText = sql
cmd.CommandType = CommandType.Text
cmd.Connection = OpenConnection
da.SelectCommand = cmd
da.Fill(ds)
ifrmClientMessage = new frmClientMessage
ifrmClientMessage.rsMessage = ds
ifrmClientMessage.ShowMessage
cmd.Connection.Dispose
cmd.Dispose
da.Dispose
ds.Dispose
End Sub
Does anyone have any idea what this is. Thanks
Michael
This is a first for me. I'm getting this error:
Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.
This happens when the dataAdapter tries to fill the dataset. This is the
only place in my code that this happens. This is the only function that this
happens. The code is below:
Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim cmd As New OleDbCommand
Dim sql As String
Dim ds As New dataset
Dim da as new OleDbDataAdapter
sql = "SELECT ClientMessages.MessageId, ClientMessages.EffectiveDate,
ClientMessages.Message, ClientMessages.WhoFor,"
sql = sql & "ClientMessages.Acknowledged, PATIENT.LastName + ', ' +
PATIENT.FirstName as ClientName "
sql = sql & "FROM ClientMessages LEFT JOIN PATIENT ON
ClientMessages.PatientId = PATIENT.PatientID "
sql = sql & "Where ClientMessages.EffectiveDate <= #" &
now.ToShortDateString & "# And ClientMessages.Acknowledged = 0 "
sql = sql & "And ClientMessages.PatientId = '" & "529195929" & "' "
sql = sql & "ORDER BY ClientMessages.EffectiveDate"
cmd.CommandText = sql
cmd.CommandType = CommandType.Text
cmd.Connection = OpenConnection
da.SelectCommand = cmd
da.Fill(ds)
ifrmClientMessage = new frmClientMessage
ifrmClientMessage.rsMessage = ds
ifrmClientMessage.ShowMessage
cmd.Connection.Dispose
cmd.Dispose
da.Dispose
ds.Dispose
End Sub
Does anyone have any idea what this is. Thanks
Michael