The existing web service return DataSet, and produces the following XML.
As it returns more than one row, I need to retirieve the Postcode value from the 1ST ROW only. I am using C# method to retrieve the Dataset value, but don't know how to do it.
My C# method in the code behind page to call the web service method is as below:
private DataSet GetPostcode(string txtSuburb, string txtState, string txtPostcode)
{
DataSet PostCodeSet = new DataSet();
PostcodeService pcode = new PostcodeService();
PostCodeSet = pcode.GetPostcodeAndSuburbForAustralia(txtSuburb, txtState, txtPostcode);
}
return PostCodeSet;
}
Here is what I have got in the Button_Click event of my Web Page:
DataSet PCodeSet = new DataSet();
PCodeSet = GetPostcode(StateList.SelectedValue.ToString(), HomeSuburbTextbox.Text.ToString(), null);
HomePostcodeLabel.Text = ??????????
So my question is how to populate the Label with the Postcode value from the 1st row. Any help would be really appreciated. Thanks.
vivek kulkarniPosted Apr 27, 2009, 12:19 PM
Hi Sayed,
if you are certain to get value in a particular collumn and row you can use
ds.Tables[0].Rows[0][0].ToString();
where ds.tables[index].Rows[index][index]
Thank you,