Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Consuming a web service issue

Status
Not open for further replies.

PM2000

Programmer
Aug 18, 2000
42
BM
Hi,

I have a web service that returns a dataset. This service works fine and I can see the returned dataset in the browser if I preview the web service. The service returns a specific employees ID, name, and position.

My ASP.Net web application needs to consume this service. When it receives the dataset, it should take the Employee ID, Employee Name, and the position and put it in corresponding text boxes on the asp.net form.

I am unable to get it to do this and can't find any code out there that shows me how to. Is a dataset the wrong way to return data like this? Does anyone have some sample code that can quickly show how to do something like this?

Thanks in advance!
Peter



 
The DataSet is the correct way to do it. If you could show us the consuming code you wrote we could understand what you are doing wrong.

In theory, if hte web service works and it's referenced in the correct way then you should be able to declare a Dataset like this:
[c#]
DataSet ds = whatever.localhost.GetEmployee();

once you have the dataset filled you can access the fields:

[c#]
For(int i; i < ds.Tables[&quot;myTable&quot;].Rows.Count;i++)
{
DataRow dr = ds.Tables[&quot;myTable&quot;].Rows;
txtbox1.text = dr[&quot;FieldName&quot;].ToString();
}


hth Daren J. Lahey
Just another computer guy...
 
Alcar,

Thanks for the advice, now it works like a charm. I wasn't using the datarow properly.

Peter
 
Glad I could help Peter. Daren J. Lahey
Just another computer guy...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top