How to change DataSet schema in C # ASP.Net Runtime
Is it typed or untyped DataSet
? For typed ones, this is probably not a good idea to start. But for untyped, just manipulate tables Columns
, etc., or add / remove tables / associations. Was there anything in particular that was painful? Or do you mean an adapter circuit?
Personally, I rarely use it DataSet
, preferring standard POCO classes for entities (maybe with an ORM like LINQ-to-SQL / Entity Framework / NHibernate). But some people like ...
source to share
We had a similar problem. Here's what we did. The database server stores the time in GMT. And the web service returned all GMT. So, in C #, we set the timezone to UTC and display using localization.
DataSet newDset = srcTable.Clone();
DataTable dTable = newDset.Tables[0];
for (int j = 0; j < dTable.Columns.Count; j++)
{
if (dTable.Columns[j].DataType.ToString() == "System.DateTime")
{
dTable.Columns[j].DateTimeMode = DataSetDateTime.Utc;
}
}