private void setData(int row, int col) { if (!string.IsNullOrEmpty(dataGridViewX1.Rows[row].Cells["sum"].Value.ToString())) { int s = 1; int.TryParse(dataGridViewX1.Rows[row].Cells["sum"].Value.ToString(), out s); if (s == 0) { MessageBox.Show("数量不能是零!"); return; } } Maptool.soso.Link_Mid m = new soso.Link_Mid(); m.id = (int)dataGridViewX1.Rows[row].Cells["linkid"].Value; m.iden = Convert.ToInt32(iden_lab.Text); m.Sum = string.IsNullOrEmpty(dataGridViewX1.Rows[row].Cells["sum"].Value.ToString()) ? 1 : (int)dataGridViewX1.Rows[row].Cells["sum"].Value; m.StockType = GetUnitNo(dataGridViewX1.Rows[row].Cells["stocktypes"].Value.ToString()); m.PriceType = GetUnitNo(dataGridViewX1.Rows[row].Cells["pricetypes"].Value.ToString()); m.Updated = DateTime.Now; if (m.StockType != 1 && string.IsNullOrEmpty(dataGridViewX1.Rows[row].Cells["sum"].Value.ToString())) { MessageBox.Show("数量不能空!"); } else { if (m.Sum == 0) { m.Sum = 1; } soso.syntoolSoapClient bll = new soso.syntoolSoapClient(); bll.SetData(m, col, Login.authKey); } }