c# - Hard code a value into a data table -
how hard code value 1 fields of info table. have.
//create info table temporary storage datatable mytable = new datatable(); protected void createtable(datatable mytable) { mytable.columns.add("pilotid"); mytable.columns.add("start_date"); mytable.columns.add("end_date"); mytable.columns.add("hours"); }
you can utilize datacolumn.expression set column constant value.
for example:
// number mytable.columns["pilotid"].expression = "1"; // string mytable.columns["pilotid"].expression = "'mypilot'";
then every row added info table have same constant value in column. datarow throw exception if code tries alter constant value.
c# datatable
No comments:
Post a Comment