Hi
I am new to VB.net windows application.
Can any one tell me how to return a function as dataset
eg..
public function Test () as dataset
try
Dim sProc As String = "Storedprocedure_Name"
Dim cmdFunds As New OracleCommand(sProc, oOracleConn)
cmdFunds.CommandType = CommandType.StoredProcedure
cmdFunds.Parameters.Add("po_cursor", OracleType.Cursor)
cmdFunds.Parameters(0).Direction = ParameterDirection.Output
test =
catch
test =nothing
endtry
end function
Thanks in advance.

Dataset
kabucek
Hi
Thanks for your reply
this is what i expected
magmo
you need to have a dataset instance in order to return it back to the caller. you can't just make a string into a dataset for example and return it. the way to do it would be this typically:
public function DoStuff() as DataSet
Dim theDataSet as new DataSet()
return theDataSet
end function
in your example, not entirely sure what you are doing but you could use a DataAdapter to read data and fill it into a dataset then return this back to the caller. Example using Sql:
public function DoStuff() as DataSet
Dim theDataSet as new DataSet()
Dim theSQLCommand as new SqlCommand("storedProcName", new SqlConnection(connectionString))
theSQLCommand.CommandType = CommandType.StoredProcedure
Dim theDataAdapter as new SqlDataAdapter(theSQLCommand)
theSQLCommand.Connection.Open()
theDataAdapter.Fill(theDataSet)
theSQLCommand.Connection.Close()
return theDataSet
end function
this would execute the stored proc on the database and fill the results returned from it into the dataset and return it back to the caller.
is this what you are after