毕业论文

打赏
当前位置: 毕业论文 > 计算机论文 >

C#高职计算机导论考试系统设计与实现(21)

时间:2016-11-22 23:24来源:毕业论文
// 向用户确认操作 DialogResult result = MessageBox.Show( 确认要保存修改吗?, 操作提示, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { // 自动生


            // 向用户确认操作
            DialogResult result = MessageBox.Show(
                            "确认要保存修改吗?", "操作提示",
                            MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                // 自动生成用于更新的命令
                SqlCommandBuilder builder = new SqlCommandBuilder(dataAdapter);

                // 将数据集中修改过的数据,提交到数据库
                dataAdapter.Update(dataSet, "Question");
            }
        }

        private void btnRefurbish_Click(object sender, EventArgs e)
        {
            // SQL 查询语句
            string sql = "select QuestionId,Question,OptionA,OptionB,OptionC,OptionD,Answer,Difficulty,SubjectId from Question";

            // 清空表中原有的数据
            dataSet.Tables["Question"].Clear();
            // 重新指定 DataAdapter 对象的查询语句
            dataAdapter.SelectCommand.CommandText = sql;
            // 重新填充数据集
            dataAdapter.Fill(dataSet, "Question");        } C#高职计算机导论考试系统设计与实现(21):http://www.youerw.com/jisuanji/lunwen_181.html
------分隔线----------------------------
推荐内容