1. 程式人生 > >datatable 增加一行並賦值

datatable 增加一行並賦值

   tablesm.Columns.Add("MAIN_MODEL", typeof(string));
        for (int i = 0; i < tablesm.Rows.Count; i++)
        {
            string wo = tablesm.Rows[i]["work_order"].ToString();             string SQL = "select  MAIN_MODEL1 from SFC.R_WO_BASE_T where work_order='" + wo + "' ";
            DataTable table = new DataTable();
            table = ut.OracleDataQuery(SQL, ConnectionStringReprot);            string MAIN_MODEL1 = table.Rows[0]["MAIN_MODEL1"].ToString();
           tablesm.Rows[i]["MAIN_MODEL"] = MAIN_MODEL1;
          
        }