G
Guest
I am experiencing the following error:
Exception Details: System.InvalidCastException: Specified cast is not valid.
Source Error:
Line 143: Dim drChange As Changes.tblChangesRow
Line 144: Dim iCurrentRow As Integer
Line 145: drChange = dsChange.Tables(0).Rows(iCurrentRow)
Line 146: If drChange.IsChangeDescriptionNull Then
Line 147: Else
Source File: c:\inetpub\wwwroot\ITApplications\UpdateChangeRequest.aspx.vb
Line: 145
My code that I am using is:
Dim dsChange As New DataSet
Dim cmdChange As New SqlCommand
Dim sSelect As String = "SELECT ChangeID, ChangeDescription, ChangeRisk,
ChangePlan, WhoAffected, EstCompDate, ActCompDate, AssignedTo, Notes, Status
FROM tblChanges WHERE ChangeID = " & Integer.Parse(Request.QueryString("ID"))
cmdChange.CommandText = sSelect
cmdChange.Connection = SqlConnection1
Dim daChange As New SqlDataAdapter
daChange.SelectCommand = cmdChange
daChange.MissingSchemaAction = MissingSchemaAction.AddWithKey
daChange.Fill(dsChange)
Dim chg As New ChangesDP
Dim drChange As Changes.tblChangesRow
Dim iCurrentRow As Integer
drChange = dsChange.Tables(0).Rows(iCurrentRow)
Why is this an invalid cast? Any help is appreciated.
Exception Details: System.InvalidCastException: Specified cast is not valid.
Source Error:
Line 143: Dim drChange As Changes.tblChangesRow
Line 144: Dim iCurrentRow As Integer
Line 145: drChange = dsChange.Tables(0).Rows(iCurrentRow)
Line 146: If drChange.IsChangeDescriptionNull Then
Line 147: Else
Source File: c:\inetpub\wwwroot\ITApplications\UpdateChangeRequest.aspx.vb
Line: 145
My code that I am using is:
Dim dsChange As New DataSet
Dim cmdChange As New SqlCommand
Dim sSelect As String = "SELECT ChangeID, ChangeDescription, ChangeRisk,
ChangePlan, WhoAffected, EstCompDate, ActCompDate, AssignedTo, Notes, Status
FROM tblChanges WHERE ChangeID = " & Integer.Parse(Request.QueryString("ID"))
cmdChange.CommandText = sSelect
cmdChange.Connection = SqlConnection1
Dim daChange As New SqlDataAdapter
daChange.SelectCommand = cmdChange
daChange.MissingSchemaAction = MissingSchemaAction.AddWithKey
daChange.Fill(dsChange)
Dim chg As New ChangesDP
Dim drChange As Changes.tblChangesRow
Dim iCurrentRow As Integer
drChange = dsChange.Tables(0).Rows(iCurrentRow)
Why is this an invalid cast? Any help is appreciated.