private void button2_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count <= 0)
            {
                return;
            }            if (MessageBox.Show("确定退换?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                string sid = this.dataGridView1.SelectedCells[0].Value.ToString();
                string sql = "Select tuihuoshuliang from tb_tuihuo where id='" + sid + "'";
                DBHelper.ExecSql("INSERT INTO tb_tuihuo (daichuli,) VALUES '" + sql + "'");
                string bian = "delete from TB_tuihuo where id='" + sid + "'";
                bool B = DBHelper.ExecSql(bian);
                if (B)
                {
                    MessageBox.Show("操作成功"); getdate();
                }
                else
                {
                    MessageBox.Show("操作错误,请检查数据是否合法!");
                }
            }
        }

解决方案 »

  1.   

    string sid = this.dataGridView1.SelectedCells[0].Value.ToString();
                    string sql = "Select tuihuoshuliang from tb_tuihuo where 
                    id='"+this.dataGridView1.SelectedCells[0].Value.ToString() + "'";
                    DBHelper.ExecSql("INSERT INTO tb_tuihuo (daichuli,) VALUES '" + sql + "'");
                    string bian = "delete from TB_tuihuo where id='" + sid + "'";
                    DBHelper.ExecSql(bian);
                    MessageBox.Show("操作成功"); getdate();
      

  2.   

    DBHelper.ExecSql(bian);返回的是bool类型吗?