Click here to Skip to main content
15,904,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
How to change the datatype of a list in asp.net while already having data in.
I have an int field that has to be typeof(string)
i want convert datatype high speed without change design in database

this is my code :

<pre lang="C#">var DT = db.dehagh_datas.Where(x => x.DateTime > DateTime.Parse(dteStart.Text) && x.DateTime < DateTime.Parse(dteEnd.Text)).ToList();


in veriable DT i want chane FieldType T2 from string to int
please help
regards yarian

What I have tried:

How to change the datatype of a list
in asp.net while already having data in.
I have an int field that has to be typeof(string)
Posted
Updated 9-Oct-16 20:37pm

1 solution

C#
IEnumerable<dynamic> query = (IEnumerable<dynamic>)db.dehagh_datas.Where(x => x.DateTime > DateTime.Parse(dteStart.Text) && x.DateTime < DateTime.Parse(dteEnd.Text)).ToList();
var DT = query.Where(x => x.DateTime > DateTime.Parse(dteStart.Text) && x.DateTime < DateTime.Parse(dteEnd.Text)).Select(x => (Int32)x.T2).ToList();


You cannot use Convert() function in Lambda expression.
 
Share this answer
 
v3

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