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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What datatype should i use?

Status
Not open for further replies.
Jun 5, 2006
28
US
Not sure what data type to use for this. (language c#).

I have a function that takes in three values a row, column and a string. (I have no idea how many rows or columns there will be). I will later need to pull the values in the following order.

First Row, First Column
First Row, Second Column
....
Second Row, First Column
Second Row, Second Column


IF you could show me how to fill in the data into the datatype i would greatly appreciate that as well.

Thanks.
 
You could use a DataTable. Or create your own item using List<> object.
 
To fill the DataTable, you need to do the following

Code:
DataTable table = new DataTable();
DataRow Newrow;

//For as many columns you need
table.Colums.Add(); //or table.Colums.Add("ColumnName")
//you can loop that obviously

//for as many rows that you need
Newrow = table.NewRow();
Newrow.ItemArray = object [table.Colums.Count] 
{
//as many items to fill the array
};
table.Rows.Add(Newrow);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top