473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

dataset recordcount returned via function

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",stor edParams)

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??

Nov 19 '05 #1
2 1387
Solved..

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

Nov 19 '05 #2
Why not just pass a NULL (NOTHING) back when there are no records?

<dr****@canoemail.com> wrote in message
news:11********************@o13g2000cwo.googlegrou ps.com...
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",stor edParams)

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??

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
2
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
8
by: Programatix | last post by:
Hi, I'm working on a project which includes XML WebServices and Windows Form application. The Windows Form application will call the XML WebServices to retrieve data from database. The data...
2
by: Jeff Boyer | last post by:
Hello everyone, Can someone tell me why a ADO recordset.recordcount would return a -1? I have confirmed that it has records in it by writing some values to the screen. Why can't I count the...
19
by: Adam Short | last post by:
I am trying to write a routine that will connect a .NET server with a classic ASP server. I know the following code doesn't work! The data is being returned as a dataset, however ASP does not...
1
by: Philip Townsend | last post by:
Is there any way to manually add a record to a dataset? In my case, I may need to populate the dataset from a stored procedure or xml file, but in some cases I may need to manually add an...
10
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.