dataset recordcount returned via function

D

drdave

Hi

I have a situation where I call a function and return a dataset, this
works fine but I am trying to figure out the best way to send back to
the call page whether or not there are records returned.

What I'm tring to accomplish..

dgSearchResults.DataSource = ReportFour.GetReport4
(ddlprovlist.SelectedItem.Value,stryearval)
Dim RcdCount As Integer
RcdCount = Dset.Tables(0).Rows.Count.ToString()


If RcdCount < 1
Response.Write ("No Matches")
Else
add datagrid to the page
dgSearchResults.DataBind ()
pnlSearchResults.Controls.Add(dgSearchResults)
End If

My Function looks like this:


Public Shared Function GetReport4(ByVal jur As Integer, ByVal year As
String) As DataSet
Dim connection As OracleConnection = New
OracleConnection(ConfigurationSettings.AppSettings("connectionstring"))

Dim storedParams(2) As OracleParameter


storedParams(0) = New OracleParameter("jurid",
OracleDbType.Int32, ParameterDirection.Input)
storedParams(0).Value = jur
storedParams(1) = New OracleParameter("datefrom",
OracleDbType.Varchar2, ParameterDirection.Input)
storedParams(1).Value = year

storedParams(2) = New OracleParameter("custom_cursor",
OracleDbType.RefCursor, ParameterDirection.Output)
storedParams(2).Value = "custom_cursor"



Dim dset As Dataset =
OracleHelperV2.ExecuteDataset(connection, CommandType.StoredProcedure,
"REPORT_MW_CUSTOMSEARCH_PKG.GET_CUSTOMSEARCH",storedParams)

Select HttpContext.Current.Session("Language")

Case "en-CA"
dset.Tables(0).Columns(6).ColumnName = "provincename"
Case "fr-CA"
dset.Tables(0).Columns(7).ColumnName = "provincename"

End Select

return dset

End Function


In my calling page I get err message that dset isn't declared, any
pointer on best way to handle this??
 
D

drdave

Solved..

k I used the dgrid.Items.Count "After" databinding and it did the tirck
for me..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top