Public Function ExecCommand(ByVal sql As String) As SqlDataReader
Dim dReader As SqlDataReader
Dim cmd As New SqlCommand()
cmd.CommandText = sql
cmd.Connection = sm
Dim isOpened = OpenConnection()
If isOpened Then
dReader = cmd.ExecuteReader()
CloseConnection()
End If
Return dReader
End Function
它說也許在運行時可能會發生空指定,以聲明該datareader。這是爲什麼?從C sharp到Vb簡單問題的初學者移民
什麼是你的函數應該返回如果'isOpened'是錯誤的? – Heinzi 2011-03-17 10:58:24
當我看到本網站上發佈的一些代碼時,我經常想哭。 – 2011-03-17 13:11:11