#region 添加支款方式--向已写好的多行插入sql语句中添加字段和值 public int A_ZhifuFS(int diqu) { int i = 0; string strData = @"SELECT '492494' rwd,'11' rq,'1' bl,'壹元整' md,'1' mr,'a' kx,'055fa99b-a932-4924-9430-71cf13bb6858' gid UNION ALL SELECT '492494','1','1','壹元整','1','b','055fa99b-a932-4924-9430-71cf13bb6858' UNION ALL SELECT '492494','1','1','壹元整1','1','c','055fa99b-a932-4924-9430-71cf13bb6858'"; if (!string.IsNullOrEmpty(strData)) { //这里执行的是忒么的多条。 string strSQL = "insert into zab_hetongZK (htzk_rwdid, htzk_day, htzk_bili, htzk_MoneyD, htzk_MoneyR,htzk_Lx,htzk_guID) " + strData; _db.ExcuteSqlTwo(strSQL); //先去获得两个字段的值 ZAB_BLL.GetTime GT = new GetTime(); string strTime = GT.GetTimes("zab_hetongZK", "htzk_id", null, 0);//获得时间 //strTime='20131111','20131111'//(两个时间) strTime += "," + diqu;//再加上地区 //更新SQL语句 int insertCount = strData.ToLower().Replace("select", "select1").Length - strData.Length;//获得select个数 int selectIndex = 0; for (int ii = 0; ii < insertCount; ii++) { strData = strData.Insert((strData.ToLower().IndexOf("select", selectIndex) + 7), string.Format(" {0},", strTime));//在select后加入值 selectIndex = strData.ToLower().IndexOf("select", selectIndex) + 7; } strSQL = "insert into zab_hetongZK (LastEditDate,CreationDate,tb_diqu,htzk_rwdid, htzk_day, htzk_bili, htzk_MoneyD, htzk_MoneyR,htzk_Lx,htzk_guID) " + strData; int i = _jtdb.ExcuteSqlTwos(strSQL);//by ltr } return i; } #endregion