错误“Fill:SelectCommand.Connection属性尚未初始化” [英] Error "Fill: SelectCommand.Connection property has not been initialized"
本文介绍了错误“Fill:SelectCommand.Connection属性尚未初始化”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如上所述,我收到错误
填写:SelectCommand.Connection属性尚未初始化
这里有人对如何解决这个错误有任何想法或建议吗?
我的代码(.aspx.vb )对于这个程序
As mention on the title above, i got an error
Fill: 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
我的.vb代码是
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
谁在这里谁愿意帮助我? :'(
Anyone here who's willing to help me? :'(
推荐答案
嗨SaschaLefèvre和ArunRajendra :)
我成功解决了这个错误!我在这一行添加了参数:
Hi Sascha Lefèvre and ArunRajendra :)
I'm success to solved this error ! I added the parameter on this line :
Dim DHHConn As New DRConnection("", "DHHConn")
无论如何,感谢您的帮助:)
Anyway, thanks for help :)
这篇关于错误“Fill:SelectCommand.Connection属性尚未初始化”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文