473,786 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetR eport4
(ddlprovlist.Se lectedItem.Valu e,stryearval)
Dim RcdCount As Integer
RcdCount = Dset.Tables(0). Rows.Count.ToSt ring()
If RcdCount < 1
Response.Write ("No Matches")
Else
add datagrid to the page
dgSearchResults .DataBind ()
pnlSearchResult s.Controls.Add( dgSearchResults )
End If

My Function looks like this:
Public Shared Function GetReport4(ByVa l jur As Integer, ByVal year As
String) As DataSet
Dim connection As OracleConnectio n = New
OracleConnectio n(Configuration Settings.AppSet tings("connecti onstring"))

Dim storedParams(2) As OracleParameter
storedParams(0) = New OracleParameter ("jurid",
OracleDbType.In t32, ParameterDirect ion.Input)
storedParams(0) .Value = jur
storedParams(1) = New OracleParameter ("datefrom",
OracleDbType.Va rchar2, ParameterDirect ion.Input)
storedParams(1) .Value = year

storedParams(2) = New OracleParameter ("custom_cursor ",
OracleDbType.Re fCursor, ParameterDirect ion.Output)
storedParams(2) .Value = "custom_cur sor"

Dim dset As Dataset =
OracleHelperV2. ExecuteDataset( connection, CommandType.Sto redProcedure,
"REPORT_MW_CUST OMSEARCH_PKG.GE T_CUSTOMSEARCH" ,storedParams)

Select HttpContext.Cur rent.Session("L anguage")

Case "en-CA"
dset.Tables(0). Columns(6).Colu mnName = "provincena me"
Case "fr-CA"
dset.Tables(0). Columns(7).Colu mnName = "provincena me"

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 1410
Solved..

k I used the dgrid.Items.Cou nt "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****@canoema il.com> wrote in message
news:11******** ************@o1 3g2000cwo.googl egroups.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.GetR eport4
(ddlprovlist.Se lectedItem.Valu e,stryearval)
Dim RcdCount As Integer
RcdCount = Dset.Tables(0). Rows.Count.ToSt ring()
If RcdCount < 1
Response.Write ("No Matches")
Else
add datagrid to the page
dgSearchResults .DataBind ()
pnlSearchResult s.Controls.Add( dgSearchResults )
End If

My Function looks like this:
Public Shared Function GetReport4(ByVa l jur As Integer, ByVal year As
String) As DataSet
Dim connection As OracleConnectio n = New
OracleConnectio n(Configuration Settings.AppSet tings("connecti onstring"))

Dim storedParams(2) As OracleParameter
storedParams(0) = New OracleParameter ("jurid",
OracleDbType.In t32, ParameterDirect ion.Input)
storedParams(0) .Value = jur
storedParams(1) = New OracleParameter ("datefrom",
OracleDbType.Va rchar2, ParameterDirect ion.Input)
storedParams(1) .Value = year

storedParams(2) = New OracleParameter ("custom_cursor ",
OracleDbType.Re fCursor, ParameterDirect ion.Output)
storedParams(2) .Value = "custom_cur sor"

Dim dset As Dataset =
OracleHelperV2. ExecuteDataset( connection, CommandType.Sto redProcedure,
"REPORT_MW_CUST OMSEARCH_PKG.GE T_CUSTOMSEARCH" ,storedParams)

Select HttpContext.Cur rent.Session("L anguage")

Case "en-CA"
dset.Tables(0). Columns(6).Colu mnName = "provincena me"
Case "fr-CA"
dset.Tables(0). Columns(7).Colu mnName = "provincena me"

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
2256
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 returned as DataSet. Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or
2
2026
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 returned as DataSet. Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or
8
2410
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 will be returned as DataSet. Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or
2
5072
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 number of records returned though? Please help, Jeff P.S. I am using VBScript for my code connecting to a SQL Server 2000 database
19
9331
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 recognise datasets and requires a recordset. Can the datatypes be converted? At the Classic ASP end or .NET end? Can SOAP toolkit provide the conversion, can any toolkit provide a conversion? ...
1
1122
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 additional record or row. Any suggestions? Thanks! *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
10
6731
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 contains only tables. I have linked the tables for the front end to the back end database. I am trying to set the recordsource of a form to a query established by the user to narrow the scope but I don't want to display the form if there are no...
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10360
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.