Home String is converted to DateTime when putting it to a System.Data.DataTable
Reply: 0

String is converted to DateTime when putting it to a System.Data.DataTable

user454
1#
user454 Published in June 19, 2018, 2:22 pm

I'm populating a datatable with values, and one of them is the following string: "1/1/1801". In my array "values", that item is of String type. But when I assign the array to a System.Data.DataTable row, it magically turns into a datetime type:

System.Data.DataTable dt = new System.Data.DataTable();
dt.Rows.Add(dt.NewRow().ItemArray = values);

Waht's going on here and is there any way to avoid that?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.51764 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO