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.

Share this:

ABOUT THE AUTHOR

Hello We are OddThemes, Our name came from the fact that we are UNIQUE. We specialize in designing premium looking fully customizable highly responsive blogger templates. We at OddThemes do carry a philosophy that: Nothing Is Impossible

0 comments

Powered by Blogger.