Hi all.
As mention on the title above, i got an errorFill: SelectCommand.Connection property has not been initialized
Anyone here have any idea or suggestion on how to solve this error?
My code (.aspx.vb) for this program
Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Dim i As Integer
Dim result As DataSet
Dim hypID As HyperLink
Dim chkRemove As New CheckBox
Dim clsPath As New Path()
Try
For i = 0 To grdPath.Rows.Count - 1
chkRemove = DirectCast(grdPath.Rows(i).FindControl("chkRemove"), CheckBox)
hypID = DirectCast(grdPath.Rows(i).FindControl("hypID"), HyperLink)
If chkRemove.Checked Then
result = clsPath.getComparedPathID(chkRemove.Text)
End If
Next i
lblErrorMessage.Text = "Paths delete successfully."
BindGrid("%", "%", drpArea.SelectedValue, drpType.SelectedValue)
Catch ex As Exception
lblErrorMessage.Text = ex.Message
End Try
End Sub
And my .vb code is
Public Function getComparedPathID(ByVal DeletePathID As String) As DataSet
Dim DHHConn As New DRConnection("", "")
Dim ds As DataSet
Try
ds = DHHConn.RunSPReturnDS("sp_Path_ID", New SqlParameter("@M_C", DeletePathID))
Return ds
Catch ex As Exception
LogManager.WriteLog(ex.Message)
Throw New Exception(ex.Message)
Finally
DHHConn.CloseConnection()
End Try
End Function