publicfunction getrecordfromdatabase (byval p_empid as int32) as dataview
dim con as oracleconnection = nothing dim cmd as oraclecommand = nothing dim ds as dataset = nothing
try con = getdatabaseconnection( "userid=scott;password=tiger;data source=testingdb;") cmd = new oraclecommand("administrator.getemployee", con) cmd.commandtype = commandtype.storedprocedure cmd.parameters.add(new oracleparameter("employeeid", oracledbtype.int64)).value = p_empid dim param asnew oracleparameter("rc1", oracledbtype.refcursor) cmd.parameters.add(param).direction = parameterdirection.output dim mycommand asnew oracledataadapter(cmd) ds = new dataset mycommand.fill(ds) dim table as datatable = ds.tables(0) dim index as int32 = table.rows.count return ds.tables(0).defaultview catch ex as exception thrownew exception("exception in database tier method getrecordfromdatabase () " + ex.message, ex)
finally
try cmd.dispose() catch ex as exception finally cmd = nothing endtry try con.close() catch ex as exception finally con = nothing endtry endtry endfunction
publicfunction getdatabaseconnection(byval strconnection as string) as oracleconnection dim con as oracle.dataaccess.client.oracleconnection = nothing try con = new oracle.dataaccess.client.oracleconnection con.connectionstring = strconnection con.open() return con catch ex as exception thrownew exception("exception in database tier method getoracleconnection() " + ex.message, ex) endtry endfunction