Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Please Help me- Returning DataSet from a Web Service

Reply
Thread Tools

Please Help me- Returning DataSet from a Web Service

 
 
Sumaira Ahmad
Guest
Posts: n/a
 
      11-01-2004
Hi All

My Web Service is returning a DataSet. I realized that we cannot
return a DataReader.. Normally we can use a DataReader( when not
using Web services) and access it as below to assign values of columns
of returned rows to Labels in the client aplication such as:

while (dtrJobDetails.Read())
{
l_shortjobdesc.Text = dtrJobDetails["shortjobdesc"].ToString();
}
where dtrJobDetails is a DataReader.

But now I am forced to return back a DataSet.. Is there anyway of
showing the individual column values returned from a DataSet in
individual labels like we do in a DataReader as above... I dont want
to show it in a DataGrid or a DataList...

Please help me.. I have been trying to figure this out since two
days..

Any help will be highly appreciated...
Thanks,
Sumaira
 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      11-03-2004
What about dropping a placeholder control onto the page and then loop
through the datarows of the dataset, adding the labels dynamically?

I've included some VB code below that might give you the idea.

Let us know if it helps?

Ken
Microsoft MVP [ASP.NET]


<form runat=server>
<asplaceHolder id="PlaceHolder1" runat="server">
</asplaceHolder></FORM>



Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim l_shortjobdesc As Label
Dim ltBR As Literal
Dim ds As New DataSet
ds = CreateDataSource()
Dim dr As DataRow
For Each dr In ds.Tables(0).Rows
l_shortjobdesc = New Label
l_shortjobdesc.Text = dr.Item("IntegerValue").ToString
ltBR = New Literal
ltBR.Text = "<br>"
PlaceHolder1.Controls.Add(l_shortjobdesc)
PlaceHolder1.Controls.Add(ltBR)
Next
End Sub
Function CreateDataSource() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New DataColumn _
("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i
dr(1) = "Item " + i.ToString()
dr(2) = 1.23 * (i + 1)
dr(3) = (i = 4)
dt.Rows.Add(dr)
Next i
ds.Tables.Add(dt)
Return ds
End Function 'CreateDataSource


"Sumaira Ahmad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi All
>
> My Web Service is returning a DataSet. I realized that we cannot
> return a DataReader.. Normally we can use a DataReader( when not
> using Web services) and access it as below to assign values of columns
> of returned rows to Labels in the client aplication such as:
>
> while (dtrJobDetails.Read())
> {
> l_shortjobdesc.Text = dtrJobDetails["shortjobdesc"].ToString();
> }
> where dtrJobDetails is a DataReader.
>
> But now I am forced to return back a DataSet.. Is there anyway of
> showing the individual column values returned from a DataSet in
> individual labels like we do in a DataReader as above... I dont want
> to show it in a DataGrid or a DataList...
>
> Please help me.. I have been trying to figure this out since two
> days..
>
> Any help will be highly appreciated...
> Thanks,
> Sumaira


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please Help me- Returning DataSet from a Web Service Sumaira Ahmad ASP .Net Web Services 1 11-02-2004 05:04 PM
Please Help me- Returning DataSet from a Web Service Sumaira Ahmad ASP .Net 2 11-02-2004 01:18 AM
Please Help me- Returning DataSet from a Web Service Sumaira Ahmad ASP .Net Datagrid Control 0 11-01-2004 09:23 PM
[Urgent] Is there a size limit on returning a large dataset or a large typed array from web service? Ketchup ASP .Net Web Services 1 05-25-2004 10:11 AM
XML Web Service fails with System.InvalidOperationException returning a DataSet with RowErrors Curly ASP .Net Web Services 0 08-19-2003 07:11 AM



Advertisments