c# - Use DataTable.Load() without creating all column properties -
i'm loading data sql server database this: sqlcommand cmd = new sqlcommand("select * x", conn); cmd.commandtype = commandtype.text; datatable dt = new datatable(); sqldatareader rd = cmd.executereader(); dt.load(rd, loadoption.preservechanges); issue: the load() function initializes table columns columnname , datatype , looks deeper database, , adds constraints allowdbnull , autoincrement , maxlength , etc. however, leads problems in application, because want further process data internally. so, possible load() setting basic properties (which come directly select statement), without setting allowdbnull , maxlength , , on? or need clean these values after load() ? or there alternative calling load() ? if don't want behaviour don't use datatable.load dbdataadapter.fill(datatable) : datatable dt = new datatable(); using(var da = new sqldataadapter("select * x", conn)) da.fill(dt); the fill operation adds rows des