我目前收到错误:
ExecuteReader 需要一个打开且可用的连接。连接的当前状态是打开的。
这是我的代码:
db.conn 的类
Public Class db
Public Shared conn As SqlConnection = db.getsqlconn("ezondb")
Public Shared Function getsqlconn(ByVal whichdb As String) As SqlConnection
Dim connstring As String = ConfigurationManager.ConnectionStrings(whichdb).ConnectionString
Return New SqlConnection(connstring)
End Function
Dim Macomm = db.selectcommand(db.conn, "*", "categories", "idparentcategory=1")
Dim Mada As New SqlDataAdapter(Macomm)
Dim Mat As New DataTable
Mada.Fill(Mat)