public DataSet GetNewId(List<string> IdArr) { DataSet ds = new DataSet(); DataTable newtb = new DataTable(); DataColumn column = new DataColumn("cnt", typeof(string));//新增列 newtb.Columns.Add(column); for (int i = 0; i < IdArr.Count; i++) { StringBuilder sbSql = new StringBuilder(); sbSql.Append("insert into y (PatientID,PathologyNumber,PatientState,Classification,HospitalOfDelivery,DepartmentOfDelivery,"+ " Remark8,CliMedicalID,MedicalClass,ImageCheck,ControlType from y where id=‘" + IdArr[i] + "‘; SELECT @@IDENTITY as id"); object o = DbHelperMySQL.GetSingle(sbSql.ToString()); if (o!=null) { DataRow newRow = newtb.NewRow(); newRow["cnt"] = o.ToString(); newtb.Rows.Add(newRow); } } ds.Tables.Add(newtb); return ds; }
时间: 2024-11-05 15:56:26