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