c#关于修改信息的问题 有一个webform窗体,当点击查询信息按钮时会出现好多信息,当我点击其中一条信息中的一条数据时,数据会出现在下面的要修改的textbox中,可是我有的信息不需要修改就空在那,就填要修改的框,最后运行时数据库里面的信息就变了,我没点击修改的信息就变成空白了,怎么回事啊?而且变一条信息下面一列的数据都成一样的了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void button2_Click(object sender, EventArgs e) { if (MessageBox.Show("确定要修改吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { sqlondmc.SQL = "update Teacher_Info set Class='" + comboBox2.SelectedIndex + "',Subject='" + textBox3.Text.Trim() + "',Address='" + textBox4.Text.Trim() + "',Tel='" + textBox2.Text.Trim() + "' where Teacher_ID='" + textBox5.Text.Trim() + "'"; sqlondmc.ReturnDataSet(); } } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { comboBox2.Text = dataGridView1[4, dataGridView1.CurrentCell.RowIndex].Value.ToString(); textBox3.Text = dataGridView1[5, dataGridView1.CurrentCell.RowIndex].Value.ToString(); textBox4.Text = dataGridView1[7, dataGridView1.CurrentCell.RowIndex].Value.ToString(); textBox2.Text = dataGridView1[6, dataGridView1.CurrentCell.RowIndex].Value.ToString(); textBox5.Text = dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value.ToString(); }为什么班级中显示的数据时0呢 我怀疑你时间用错了,点击行不要用CellContentClick事件,应该用CellClick事件 comboBox2.SelectedIndex...应该是text呢 求教 让引用某由VS生成的Dll的项目可以看到源DLL项目内的///注释 couchbase数据库,可不可以边向内存里面插入数据,边把内存数据保存到硬盘上??? VS2005 怎样使用DirectShow 如何编程获得Live Communications Server 2005的用户状态? 水晶报表不显示我的DataSet中的数据??? Excel的问题? C#资料 几个小问题 又一个问题 怎样才能把焦点设到另一个窗体上 对于基础的提问 并发集合类的线程安全问题~~~~
{
if (MessageBox.Show("确定要修改吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
sqlondmc.SQL = "update Teacher_Info set Class='" + comboBox2.SelectedIndex + "',Subject='" + textBox3.Text.Trim() + "',Address='" + textBox4.Text.Trim() + "',Tel='" + textBox2.Text.Trim() + "' where Teacher_ID='" + textBox5.Text.Trim() + "'";
sqlondmc.ReturnDataSet(); }
} private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
comboBox2.Text = dataGridView1[4, dataGridView1.CurrentCell.RowIndex].Value.ToString();
textBox3.Text = dataGridView1[5, dataGridView1.CurrentCell.RowIndex].Value.ToString();
textBox4.Text = dataGridView1[7, dataGridView1.CurrentCell.RowIndex].Value.ToString();
textBox2.Text = dataGridView1[6, dataGridView1.CurrentCell.RowIndex].Value.ToString();
textBox5.Text = dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value.ToString(); }
为什么班级中显示的数据时0呢