以下是您的问题的更新:这是来自模块。在有人辞职之后,我把这一切都拿走了,这有点乱。
Public Function MPCS_SELECT_SQL(ByVal strSQL As String, Optional ByRef readerObj As OleDbDataReader = Nothing) As OleDbDataReader 'ADODB.Recordset
Try
If OPEN_CONNECTIONS() = False Then
MessageBox.Show("Error connecting to database.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop)
MPCS_SELECT_SQL = Nothing
Exit Function
Else
If Not readerObj Is Nothing Then
If readerObj.IsClosed - False Then readerObj.Close()
End If
Dim cmdMPCS As OleDbCommand = New OleDbCommand(strSQL, conMPCS)
MPCS_SELECT_SQL = cmdMPCS.ExecuteReader()
cmdMPCS.Dispose()
End If
Catch ex As Exception
MessageBox.Show(ex.ToString & " " & strSQL)
Stop
Return Nothing
End Try
End Function