Click here to Skip to main content
16,019,873 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hello
I need read data from a table of a DataSet for a TextBox.

The DataSet works with XML.

I don't want to do with DataBindings

If you need more info, just tell me...

Thanks
Posted

dataset ds=new dataset();
sqldataAdapter sda=new sqldataAdapter("select * from tablename",connectionString);
sda.fill(ds,"TableName");
datarow dro=ds.Table["tableName"].row[0];
textbox.text=dro.ItemArray.getValue(0);
 
Share this answer
 
// Mention System.IO for access FileStream class
FileStream fs = new FileStream("FilePath", FileMode.Open);

//Mention System.Data for access Dataset and Datatable class 
        DataSet ds = new DataSet();
        ds.ReadXml(fs);  // read XML schema 
// Use a DataTable to display the members.
DataTable dt = ds.Tables["member"];

textbox.Text = dt.Rows[row][col].ToString() // binding textbox to specified rows
 
Share this answer
 
C#
DataSet ds=new DataSet();
DataSet ds = new DataSet();
//read the xml file to dataset
ds.ReadXml(Server.MapPath("XML.xml"));
//get the value to text box
TextBox1.Text=ds.Tables[0].Rows[0][0].ToString();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900