Dataset finding and value assign

  • Thread starter Thread starter Wilson Wu
  • Start date Start date
W

Wilson Wu

Hi,

How can I find the field value in the dataset and then assign one of the
field value to a variable ?

Thanks
Wilson
 
Wilson,

Well, if you have a dataset, there are a few pieces of information you
need to know:

- The name of the table
- Which row the data is in
- Which column the data is in

If you know that, you can get/set the information like this:

// Assume pobjDataSet is the data set.
pobjDataSet.Tables[<table name or index>].Rows[<row index>][<column name or
index>] = <value>;

Hope this helps.
 
Hi,

I cannot read the value from the cell. Pls help.
The program should read data from an XML file(without schema) and find value
from one cell.

Here is my code :

DataSet dsLogon = new DataSet();
dsLogon.ReadXML(Server.MapPath("XMLFile.XML");

DataView dvServer = new DataView(dsLogon.Tables["Server"];
dvServer.Sort = "Name";
dvServer.RowFilter = "Name = '" + this.Server.Text + "'";

this.AppHost = dvServer.Table.Rows["ServerIP"].ToString();


Thanks
Wilson








Nicholas Paldino said:
Wilson,

Well, if you have a dataset, there are a few pieces of information you
need to know:

- The name of the table
- Which row the data is in
- Which column the data is in

If you know that, you can get/set the information like this:

// Assume pobjDataSet is the data set.
pobjDataSet.Tables[<table name or index>].Rows[<row index>][<column name or
index>] = <value>;

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Wilson Wu said:
Hi,

How can I find the field value in the dataset and then assign one of the
field value to a variable ?

Thanks
Wilson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top