Oracle .net Provider dataset function
Simple Oracle connection function.
Function getdata(ByVal conn As String, ByVal q As String) As DataSet
Dim data As New System.Data.DataSet()
Dim OC As New OracleClient.OracleConnection(conn)
Try
OC.Open()
Dim OCMD As New OracleClient.OracleCommand()
OCMD.CommandText = q
Dim ODA As New OracleClient.OracleDataAdapter(OCMD.CommandText, OC.ConnectionString)
ODA.Fill(data)
OC.Close()
Catch ex As Exception
End Try
Return (data)
End Function
pass in connection string and query, returns data.
remember on the
Dim RS as dataset = getdata(conn,q) to handle a empty dataset.
Function getdata(ByVal conn As String, ByVal q As String) As DataSet
Dim data As New System.Data.DataSet()
Dim OC As New OracleClient.OracleConnection(conn)
Try
OC.Open()
Dim OCMD As New OracleClient.OracleCommand()
OCMD.CommandText = q
Dim ODA As New OracleClient.OracleDataAdapter(OCMD.CommandText, OC.ConnectionString)
ODA.Fill(data)
OC.Close()
Catch ex As Exception
End Try
Return (data)
End Function
pass in connection string and query, returns data.
remember on the
Dim RS as dataset = getdata(conn,q) to handle a empty dataset.
0 comments :