Thanks Sean, I see your point. I have a different web method that will be
returning various stuff and I now see that I can accomplish this by passing
a string array that can include all of the data.
Phil, in response to your last email, the reason I can't determine the
dataset count on the client or application side by just finding the total
rows in the dataset is because I am not returning the complete results set
to the client. I am going to only send the data for a specific page that I
am requesting. I will build the sql query in sql server and then based on
the page parameter I will only returned the desired results, but I still
needed to know how many results where found in the entire result set to
implement a paging mechanism.
...Thanks for both of your help. Rich
-----Original Message-----
From: Sean Marchiafava [mailto:smarch@c...]
Sent: Thursday, November 14, 2002 3:24 PM
To: ASPX_Professional
Subject: [aspx_professional] RE: Webservice/Datagrid question
.Net is very efficient with string conversion but I also like your
solution of adding an additional table with a row count row. Either will
suffice. I do this because I return various things back along with a
dataset from web services not just a complete record count.
Sean
> Sean, thanks for replying back. I like this idea, but do you think
there is
a performance impact by converting the dataset to a string in the web
method
and then reconverting the string to xml then back into a dataset on the
client side? Do you think adding an additional table on the webmethod side
and returning a datset might be less resource intensive on both sides??
Rich
-----Original Message-----
From: Sean Marchiafava [mailto:smarch@c...]
Sent: Wednesday, November 13, 2002 5:59 PM
To: ASPX_Professional
Subject: [aspx_professional] RE: Webservice/Datagrid question
Return a string array delimited by a character, one being the dataset
and one being the record count. I have done this on several web methods
and it works fine.
Web Method code:
YourDataAdapter.Fill(dataset)
Dim tmpstring As String
tmpstring = dataset.GetXml.ToString
Dim sRecordCount as string = "Your record count"
tmpstring = tmpstring & "~" & sRecordCount
Return tmpstring
Application code:
Dim ds as new dataset
Dim arrString() As String = Split(Call WebMethod,"~")
Dim sr As New System.IO.StringReader(arrString(0))
Dim xml As New System.Xml.XmlTextReader(sr)
Dim iRecordCount as integer = Cint(arrString(1))
Dim ds As New DataSet()
ds.ReadXml(xml)
Sean
-----Original Message-----
From: Rich K [mailto:rich@r...]
Sent: Wednesday, November 13, 2002 12:27 PM
To: ASPX_Professional
Subject: [aspx_professional] RE: Webservice/Datagrid question
Phil,
Since I am sending a page number and page size to the webservice
method the
row count is only the number of records in datset that is returned. I
need
to pass the total number of records that the search criteria found. I
generate this total in sql, but I am not sure how to return it in the
web
method. The webmethod is returning a dataset. I can include anthor row
in
the initial table something like totalcount but that would be included
in
every record that is returned which in my opinion a waste of bandwidth.
It
is a fixed value for the particular search. I can create a new table and
add
one row namely totalcount and add this to the returned datset, but I am
not
sure if this is the best way to accomplish what I am trying to do??
-----Original Message-----
From: Philip Steel [mailto:PhilipS@t...]
Sent: Wednesday, November 13, 2002 3:53 AM
To: ASPX_Professional
Subject: [aspx_professional] RE: Webservice/Datagrid question
once you've returned the dataset from the webservice you can easily get
the
rowcount:
myDataSet.Tables["TableName"].Rows.Count.ToString();
Phil
-----Original Message-----
From: Rich K [mailto:rich@r...]
Sent: 13 November 2002 04:09
To: ASPX_Professional
Subject: [aspx_professional] Webservice/Datagrid question
Could someone tell me if there is a better way of implementing the
following
concept.
I am designing a webservice that returns one table in a datset based on
a
certain seach criteria. I am going to use custom
paging of a datagrid on the client side to minimize memory/bandwidth
usage
on the client. My question is how do I send the total records found for
the
search criteria back to the requesting server/client? I need this
information to design the custom paging links. I thought about sending
this
information back to the client machine in a different table in the
original
dataset. Does this make sense or is there a better way to accomplish
this
task? Thanks for your ideas. Rich.