datatable 字段值 变成 string字符串

  protected string GetMyDoctorList(DataTable _datasourse)
        {
            if (_datasourse != null) {
                string reString = "";
                foreach (DataRow dr in _datasourse.Rows) {
                    reString += DBNull.Value.Equals(dr["DoctorID"]) ? "" : dr["DoctorID"].ToString() + ",";
                }
                return reString.TrimEnd(',');
            }
            return "";
        }

 

 

protect string GetMyDoctorlist(datatable _datasourse)

{  

  if(_datasource!=null){

string reString="";

foreach(dataRow dr in _datasourse){

reString +=DbNull.value.Equals(dr["Doctorid"])?"":dr["doctorID"].tostring+","+;

}

return restring.TrimEnd(',');

}

return "";

 
}

你可能感兴趣的:(datatable 字段值 变成 string字符串)