I have Datatable where column3 (FacilityTime) is Datetime. I want this column to be changed to “Object”. so that i can insert null values from FacilityTIme column to DB and also i have to format the datetime 10/12/2009 11:09:12 PM to required format while inserting into DB.
I am recieving below error if i dont change the column to object and change datettime format.
Could someone help me with this.
I tried nothing worked except changing column to object type.I did it using build datatable and for loop but now iam using linq as for loop taking too much time for 3000 rows.
Can this field be datetime in your database? Can you check your table by coming to the design section?
If your db table is in date format, you will need to convert your latest data here. Also In the first datatable you build, you need to make the relevant column type datetime.
Yes it is Datetime only in Database. its accepting only particular format 12/12/1999 11:09:09 PM something like this, and i have null values also in my column . so i want to convert my datetime into object so that null values also can be stored and convert back the remaing values to datetime using datetime.parseexact methods.
SO i want to do this using linq as for loop is time taking.
Okay I am using read range only.So its object type.Then i just have to convert my column values to datetime desired format.
May i know how to do it using linq.
@Satish_Ch Datetime doesn’t allow null values in vb.net - You will have to create type nullable(of datetime) instead for the column. Then pass Nothing for the null values