Hi.......
In my project i am using access database.in my table, 'Voucher No' field is of text type.
so when i display the records from this table in the order of voucherno,it is not in the correct order like(1,,10,11,2,21,3)..as it is of string.so how can i make it in correct order with out changing the field type as number.because in some cases i need to save the voucher no as text.is there any way to do that...
reply me plz....
Loading
Amit ChoudharyPosted Mar 12, 2010, 6:19 AM
its not possible to sort string like numbers. but if you have only numeric values in that field then its possible.. you have to customize the dataset...
retrieve the value of voucher no. explicitly and then after fetching rest data into dataset add new column named voucher no. with datatype int and now
query database for voucher no. and add one by one by converting them to number.
after that take DataView dv=new DataView() and create expression for sorting on vouchernno.
like this:
DataView dv = ds.Tables[0].DefaultView;
dv.Sort = "voucherno. asc";
Please mark as answer if it helps you.