5
Answers

How to do this with Datatable

SIVA

SIVA

12y
1.3k
1
Dear all,

I have 2 dropdown list for hours(0-23) & minutes(0-59).

Now i ll take datatable with & i ll add 2 columns for that as follows.

Datatable oDT=new Datatable();
oDT.columns.Add("H",typeof(int));
oDT.columns.Add("M",typeof(int));

now by using for loops i need to add values to H column & M column & i ll need to bind those values to Dropdown list.

bt When I am trying to add values to datatable i m getting error.

for (int i=0;i<59;i++)
 oDT["M"]=i;


Error: Can't applying indexing with [] to an expression of type system.data.datatable.

Can anybody resolve this error & let me know how to do this. 

Answers (5)