Public Function ExecuteCommand(ByVal sConnectionString As String, _
ByVal sSqlStatement As String, _
ByRef iErrorNumber As Long, _
ByRef sErrorDescription As String) As DataSet
Dim result As DataSet = Nothing
Dim iErrorValue As Integer
Dim sErrorValue As String = ""
Dim oConnection As SqlConnection = Connection(sConnectionString, iErrorValue, sErrorValue)
If iErrorValue = 0 Then
Dim da As New SqlDataAdapter(sSqlStatement, oConnection)
Dim ds As New DataSet
Try
da.Fill(ds, "Person")
If ds.Tables(0).Rows.Count() > 0 Then
result = ds
End If
Catch ex As Exception
'...
End Try
Else
iErrorNumber = iErrorValue
sErrorDescription = sErrorValue
End If
Return result
End Function
Public Function ExecuteCommand(ByVal sConnectionString As String, _
ByVal sSqlStatement As String, _
ByRef iErrorNumber As Long, _
ByRef sErrorDescription As String) As SqlDataReader
Dim result As SqlDataReader = Nothing
Dim iErrorValue As Integer
Dim sErrorValue As String = ""
Dim oConnection As SqlConnection = Connection(sConnectionString, iErrorValue, sErrorValue)
If iErrorValue = 0 Then
Dim cmd As New SqlCommand(sSqlStatement, oConnection)
oConnection.Open()
Try
Dim rdr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
If rdr.HasRows Then
result = rdr
End If
Catch ex As Exception
'...
End Try
Else
iErrorNumber = iErrorValue
sErrorDescription = sErrorValue
End If
Return result
End Function
hi!!! i have a function which returns a DataSet! then how can i convert into DataReader?? thanksss