private void button18_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage5) { return; } MessageBox.Show(comboBox9.SelectedValue.ToString() + " " + comboBox9.Text); sqlConnect cc = new sqlConnect(); if (comboBox7.Text == "" || comboBox8.Text == "" || comboBox9.Text == "") { MessageBox.Show("请指定一个班级!"); return; } string sql = "select a.开课编号hjh ,d.课程名称hjh,b.姓名hjh '授课教师hjh',f.学院名称hjh,e.专业名称hjh,c.班级序号hjh,a.上课时间地点hjh,a.评定等级hjh " + " from 开课hjh a, 教师hjh b,班级hjh c,课程hjh d ,专业hjh e,学院hjh f " + " where a.教师编号hjh = b.教师编号hjh " + " and a.班级编号hjh = c.班级编号hjh and a.课程编号hjh = d.课程编号hjh " + " and c.专业编号hjh = e.专业编号hjh and e.学院编号hjh = f.学院编号hjh " + " and a.班级编号hjh = '" + comboBox9.SelectedValue.ToString() + "'"; try { InfoType = "开课"; cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button7_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage2) { return; } if (textBox4.Text == "") { MessageBox.Show("请输入教工号!"); return; } if (textBox4.Text.Length != 6) { textBox4.Text = ""; MessageBox.Show("对不起,请输入6位数字!"); return; } sqlConnect cc = new sqlConnect(); string sql = "select a.教师编号hjh ,a.姓名hjh,a.性别hjh,b.学院名称hjh," + " a.出生年月hjh,a.学历hjh,a.职称hjh,a.电子邮箱hjh,a.联系电话hjh,a.权限级别hjh " + " from 教师hjh a ,学院hjh b where a.学院编号hjh = b.学院编号hjh " + " and a.教师编号hjh = '" + textBox4.Text + "'"; try { InfoType = "teachers"; cc.BindDataGridView(dataGridView1, sql); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { textBox4.Text = ""; cc.closeConnect(); } }
private void comboBox7_SelectedIndexChanged(object sender, EventArgs e) { comboBox8.Text = ""; comboBox9.Text = ""; if (comboBox7.SelectedValue == null) { MessageBox.Show("无可选专业!"); return; } sqlConnect cc = new sqlConnect(); string sql = "select * from 专业hjh where 学院编号hjh = '" + comboBox7.SelectedValue.ToString() + "'"; SqlDataAdapter da = new SqlDataAdapter(sql, cc.conn); DataSet ds = new DataSet(); da.Fill(ds, "专业hjh"); comboBox8.ValueMember = "专业hjh.专业编号hjh"; comboBox8.DataSource = ds; comboBox8.DisplayMember = "专业hjh.专业名称hjh"; cc.closeConnect(); }
private void button4_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("请输入开课编号!"); return; } sqlConnect cc = new sqlConnect(); string sql2 = "select * from 开课hjh where 开课编号hjh = '" + textBox1.Text + "' and 教师编号hjh = '" + this.num + "'"; DataSet ds = cc.GetDataSet(sql2); if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show("对不起,该课程不存在或不是您的课!"); return; } string sql = "select b.开课编号hjh,c.学生编号hjh,c.姓名hjh,b.成绩hjh " + " from 选修hjh b,学生hjh c" + " where b.开课编号hjh = '" + textBox1.Text + "'and b.学生编号hjh = c.学生编号hjh "; try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button1_Click(object sender, EventArgs e) { string pwd1 = textBox3.Text.Trim(); string pwd2 = textBox4.Text.Trim(); if (pwd1 == "" || pwd2 == "") { Close(); return; } if (!pwd1.Equals(pwd2)) { textBox3.Text = ""; textBox4.Text = ""; MessageBox.Show("密码不一致,请重新输入!"); return; } sqlConnect cc = new sqlConnect(); string sql = ""; if (this.tp == "系统管理员") { sql = "update " + this.tp + "hjh set 登录密码hjh = '" + pwd1 + "' where 用户名hjh = '" + this.num + "'"; } else { sql = "update " + this.tp + "hjh set 登录密码hjh = '" + pwd1 + "' where " + this.tp + "编号hjh = '" + this.num + "'"; } cc.ExecuteNonQuery(sql); cc.closeConnect(); MessageBox.Show("修改成功!"); textBox3.Text = ""; textBox4.Text = ""; Close(); }
private void TeacherUnPassedTable_Load(object sender, EventArgs e) { this.Text += "(教师:" + this.num + ")"; if (this.aN == "" || this.bN == "") { MessageBox.Show("请选择一个班级!"); return; } sqlConnect cc = new sqlConnect(); string sql = "select a.开课编号hjh,c.学生编号hjh,c.姓名hjh,b.成绩hjh " + " from 开课hjh a,选修hjh b,学生hjh c" + " where a.开课编号hjh = b.开课编号hjh and b.学生编号hjh = c.学生编号hjh " + " and b.成绩hjh<60 " + " and a.班级编号hjh='" + this.aN + "' and a.课程编号hjh ='" + this.bN + "' and a.教师编号hjh ='" + this.num + "' "; try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button2_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); if (dataGridView1.Rows.Count == 1) { Close(); return; } string sql = ""; for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { string sql2 = "insert into 开设hjh values( "; for (int j = 0; j < dataGridView1.Columns.Count - 1; j++) //dataGridView1.Columns.Count-1 { sql2 += "'" + dataGridView1.Rows[i].Cells[j].Value.ToString().Trim() + "',"; } sql2 += "'" + dataGridView1.Rows[i].Cells[dataGridView1.Columns.Count - 1].Value.ToString().Trim() + "');"; sql += sql2; } try { cc.ExecuteNonQuery(sql); MessageBox.Show("添加成功!"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); Close(); } }
private void StudentGradeResult_Load(object sender, EventArgs e) { label18.Text = this.jidian.ToString(); label19.Text = this.unpassed.ToString(); label20.Text = this.excellent.ToString(); string sql = "select b.学生编号hjh,sum((g.成绩hjh-50)*h.学分hjh)/(SUM(h.学分hjh)*10) '绩点hjh'" + " from 学生hjh b,班级hjh c,开设hjh e,开课hjh f,选修hjh g,课程hjh h,教师hjh i " + " where " + " b.班级编号hjh = c.班级编号hjh and c.专业编号hjh = e.专业编号hjh "; if (this.type == "学期") { sql += " and e.开课学期hjh = '" + kk + "' "; } else if (this.type == "学年") { sql += " and e.开课学期hjh like '" + kk + "%' "; } sql += " and e.课程编号hjh = f.课程编号hjh and b.班级编号hjh = f.班级编号hjh " + " and g.开课编号hjh = f.开课编号hjh and g.学生编号hjh = b.学生编号hjh " + " and f.课程编号hjh = h.课程编号hjh and f.教师编号hjh = i.教师编号hjh " + " and b.班级编号hjh = ( " + " select b.班级编号hjh " + " from 学生hjh a,班级hjh b " + " where a.学生编号hjh = '" + this.num + "' and a.班级编号hjh = b.班级编号hjh ) " + " group by b.学生编号hjh,g.成绩hjh " + " having (g.成绩hjh >=60 and sum((g.成绩hjh-50)*h.学分hjh)/(SUM(h.学分hjh)*10) >" + this.jidian + ") "; string sql2 = "select b.学生编号hjh,sum((g.成绩hjh-50)*h.学分hjh)/(SUM(h.学分hjh)*10) '绩点hjh'" + " from 学生hjh b,班级hjh c,开设hjh e,开课hjh f,选修hjh g,课程hjh h,教师hjh i " + " where " + " b.班级编号hjh = c.班级编号hjh and c.专业编号hjh = e.专业编号hjh "; if (this.type == "学期") { sql2 += " and e.开课学期hjh = '" + kk + "' "; } else if (this.type == "学年") { sql2 += " and e.开课学期hjh like '" + kk + "%' "; } sql2 += " and e.课程编号hjh = f.课程编号hjh and b.班级编号hjh = f.班级编号hjh " + " and g.开课编号hjh = f.开课编号hjh and g.学生编号hjh = b.学生编号hjh " + " and f.课程编号hjh = h.课程编号hjh and f.教师编号hjh = i.教师编号hjh " + " and c.专业编号hjh = ( " + " select b.专业编号hjh " + " from 学生hjh a,班级hjh b " + " where a.学生编号hjh = '" + this.num + "' and a.班级编号hjh = b.班级编号hjh ) " + " group by b.学生编号hjh,g.成绩hjh " + " having (g.成绩hjh >=60 and sum((g.成绩hjh-50)*h.学分hjh)/(SUM(h.学分hjh)*10) >" + this.jidian + ") "; sqlConnect cc = new sqlConnect(); try { DataSet ds = cc.GetDataSet(sql); DataSet ds2 = cc.GetDataSet(sql2); MessageBox.Show(ds.Tables[0].Rows.Count.ToString()); label21.Text = (ds.Tables[0].Rows.Count + 1).ToString(); label22.Text = (ds2.Tables[0].Rows.Count + 1).ToString(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button1_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); string sql = "update 学生hjh set "; int flag = 0; if (comboBox1.Text != dgvr.Cells[3].Value.ToString().Trim() || textBox5.Text != dgvr.Cells[4].Value.ToString().Trim() || textBox6.Text != dgvr.Cells[5].Value.ToString().Trim() ) { string sql2 = "select 班级编号hjh from 学院hjh a, 专业hjh b ,班级hjh c where " + " a.学院名称hjh = '" + comboBox1.Text + "' and " + " b.专业名称hjh = '" + textBox5.Text + "' and " + " c.班级序号hjh = " + textBox6.Text + " and " + " a.学院编号hjh = b.学院编号hjh and " + " b.专业编号hjh = c.专业编号hjh"; try { DataSet ds = cc.GetDataSet(sql2); if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show("找到该学生的班级编号,学院、专业、或班级信息有误!"); return; } string str = ds.Tables[0].Rows[0].ItemArray[0].ToString().Trim(); ds.Dispose(); sql += "班级编号hjh = '" + str + "' "; flag = 1; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { } } if (textBox2.Text != dgvr.Cells[1].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "姓名hjh = '" + textBox2.Text + "'"; flag = 1; } if (textBox3.Text != dgvr.Cells[2].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "性别hjh = '" + textBox3.Text + "'"; flag = 1; } if (textBox7.Text != dgvr.Cells[6].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "出生年月hjh = '" + textBox7.Text + "'"; flag = 1; } if (textBox8.Text != dgvr.Cells[7].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "联系电话hjh = '" + textBox8.Text + "'"; flag = 1; } if (textBox9.Text != dgvr.Cells[8].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "已修学分hjh = " + textBox9.Text; flag = 1; } if (textBox10.Text != dgvr.Cells[9].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "平均绩点hjh = " + textBox10.Text; flag = 1; } if (textBox11.Text != dgvr.Cells[10].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "生源地hjh = '" + textBox11.Text + "'"; flag = 1; } if (textBox12.Text != dgvr.Cells[11].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "权限级别hjh = " + textBox12.Text; flag = 1; } sql += " where 学生编号hjh = '" + label13.Text + "'"; try { if (flag == 1) { cc.ExecuteNonQuery(sql); MessageBox.Show("修改成功!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); this.Close(); } }
private void button1_Click(object sender, EventArgs e) { string tp = comboBox1.Text; string num = textBox1.Text; string pwd = textBox2.Text; if (tp != "教师" && tp != "学生" && tp != "系统管理员") { MessageBox.Show("请选择登录身份!"); return; } if (num == "") { MessageBox.Show("用户名不能为空!"); return; } if (pwd == "") { MessageBox.Show("请输入密码!"); return; } string strSQL = ""; if (tp == "系统管理员") { strSQL += "select * from 系统管理员hjh where '" + num + "' = 用户名hjh and 登录密码hjh = '" + pwd + "'"; } else { strSQL += "select * from " + tp + "hjh where '" + num + "' = " + tp + "编号hjh and 登录密码hjh = '" + pwd + "'"; } sqlConnect cc = new sqlConnect(); DataSet dataset = new DataSet(); try { dataset = cc.GetDataSet(strSQL); if (dataset.Tables[0].Rows.Count == 0) { MessageBox.Show("密码错误,请重新登录!"); return; } DataRow dr = dataset.Tables[0].Rows[0]; if (dr["权限级别hjh"].ToString() == "1") { StudentMain frm = new StudentMain(tp, num); frm.Show(); } else if (dr["权限级别hjh"].ToString() == "2") { TeacherMain frm2 = new TeacherMain(tp, num); frm2.Show(); } else if (dr["权限级别hjh"].ToString() == "5") { SystemManage frm3 = new SystemManage(tp, num); frm3.Show(); } this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); dataset.Dispose(); } }
private void button1_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); string sql = "update 教师hjh set "; int flag = 0; if (comboBox1.Text != dgvr.Cells[3].Value.ToString().Trim()) { string sql2 = "select * from 学院hjh where 学院名称hjh = '" + comboBox1.Text + "'"; DataSet ds = cc.GetDataSet(sql2); if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show("未能到该学院名称的学院编号,学院信息有误!"); return; } string str = ds.Tables[0].Rows[0].ItemArray[0].ToString().Trim(); ds.Dispose(); sql += "学院编号hjh = '" + str + "' "; flag = 1; } if (textBox2.Text != dgvr.Cells[1].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "姓名hjh = '" + textBox2.Text + "'"; flag = 1; } if (textBox3.Text != dgvr.Cells[2].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "性别hjh = '" + textBox3.Text + "'"; flag = 1; } if (textBox5.Text != dgvr.Cells[4].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "出生年月hjh = '" + textBox5.Text + "'"; flag = 1; } if (textBox6.Text != dgvr.Cells[5].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "学历hjh = '" + textBox6.Text + "'"; flag = 1; } if (textBox7.Text != dgvr.Cells[6].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "职称hjh = '" + textBox7.Text + "'"; flag = 1; } if (textBox8.Text != dgvr.Cells[7].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "电子邮箱hjh = '" + textBox8.Text + "'"; flag = 1; } if (textBox9.Text != dgvr.Cells[8].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "联系电话hjh = '" + textBox9.Text + "'"; flag = 1; } if (textBox10.Text != dgvr.Cells[9].Value.ToString().Trim()) { if (flag == 1) { sql += ","; } sql += "权限级别hjh = " + textBox10.Text; flag = 1; } sql += " where 教师编号hjh = '" + label11.Text + "'"; try { if (flag == 1) { cc.ExecuteNonQuery(sql); MessageBox.Show("修改成功!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); this.Close(); } }
private void button1_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); string sql = " select h.课程名称hjh,i.姓名hjh '授课教师hjh',h.学分hjh,h.考核方式hjh,e.开课学期hjh,g.成绩hjh " + " from 学生hjh b,班级hjh c,开设hjh e,开课hjh f,选修hjh g,课程hjh h,教师hjh i " + " where b.学生编号hjh = '" + this.num + "' " + " and b.班级编号hjh = c.班级编号hjh and c.专业编号hjh = e.专业编号hjh " + " and e.课程编号hjh = f.课程编号hjh and b.班级编号hjh = f.班级编号hjh " + " and g.开课编号hjh = f.开课编号hjh and g.学生编号hjh = b.学生编号hjh " + " and f.课程编号hjh = h.课程编号hjh and f.教师编号hjh = i.教师编号hjh "; if (checkBox1.Checked) { sql += " and g.成绩hjh >=0 "; } if (comboBox1.Text.ToString().Trim() != "*") { sql += " and e.开课学期hjh = '" + comboBox1.Text.ToString().Trim() + "' "; } try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; dataGridView1.Columns[4].ReadOnly = true; dataGridView1.Columns[5].ReadOnly = true; double total = 0; int CourseNum = 0; int totalCredit = 0; int excellent = 0; int unPassed = 0; for (int i = 0; i < dataGridView1.RowCount - 1; i++) { int tmp = int.Parse(dataGridView1.Rows[i].Cells["成绩hjh"].Value.ToString()); if (tmp <= 0) { continue; } int credit = int.Parse(dataGridView1.Rows[i].Cells["学分hjh"].Value.ToString()); CourseNum++; if (tmp < 60) { unPassed++; } if (tmp >= 95) { excellent++; } total += (double)(tmp - 50) * credit; totalCredit += credit; } total = total / (totalCredit * 10); StudentGradeResult frm = new StudentGradeResult(this.num, total, unPassed, excellent, comboBox1.Text.ToString().Trim(), "学期"); frm.ShowDialog(); frm.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button21_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); if (comboBox10.SelectedValue == null || comboBox10.DisplayMember == null) { MessageBox.Show("请选择一个班级!"); return; } string sql = "select 开课编号hjh from 开课hjh where 班级编号hjh = '" + comboBox10.SelectedValue.ToString().Trim() + "'"; DataSet ds = cc.GetDataSet(sql); sql = "select 学生编号hjh from 学生hjh where 班级编号hjh = '" + comboBox10.SelectedValue.ToString().Trim() + "'"; DataSet ds2 = cc.GetDataSet(sql); int synNum = 0; foreach (DataRow dr in ds.Tables[0].Rows) { foreach (DataRow dr2 in ds2.Tables[0].Rows) { string sql2 = "select * from 选修hjh where 开课编号hjh = '" + dr[0].ToString() + "' and " + "学生编号hjh = '" + dr2[0].ToString() + "'"; DataSet ds3 = cc.GetDataSet(sql2); if (ds3.Tables[0].Rows.Count == 0) { synNum++; if (synNum == 1) { DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); col1.Name = "开课编号hjh"; col1.HeaderText = "开课编号hjh"; col2.Name = "学生编号hjh"; col2.HeaderText = "学生编号hjh"; dataGridView1.Columns.Clear(); dataGridView1.DataSource = null; dataGridView1.Columns.Add(col1); dataGridView1.Columns.Add(col2); } sql += " insert into 选修hjh(开课编号hjh,学生编号hjh) values( '" + dr[0].ToString() + "','" + dr2[0].ToString() + "' );"; string[] row = { dr[0].ToString(), dr2[0].ToString() }; dataGridView1.Rows.Add(row); } ds3.Dispose(); } } try { if (synNum != 0) { cc.ExecuteNonQuery(sql); MessageBox.Show("共同步" + synNum.ToString() + "条记录!"); } else { MessageBox.Show("无需再次同步,该班级同学选修情况已经全部与班级开课同步!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void NewClassCourse_Load(object sender, EventArgs e) { DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col5 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col6 = new DataGridViewTextBoxColumn(); col1.Name = "开课编号hjh"; col1.HeaderText = "开课编号hjh"; col2.Name = "课程编号hjh"; col2.HeaderText = "课程编号hjh"; col3.Name = "班级编号hjh"; col3.HeaderText = "班级编号hjh"; col4.Name = "教师编号hjh"; col4.HeaderText = "教师编号hjh"; col5.Name = "上课时间地点hjh"; col5.HeaderText = "上课时间地点hjh"; dataGridView1.Columns.Add(col1); dataGridView1.Columns.Add(col2); dataGridView1.Columns.Add(col3); dataGridView1.Columns.Add(col4); dataGridView1.Columns.Add(col5); sqlConnect cc = new sqlConnect(); try { string sql = "select * from 学院hjh"; SqlDataAdapter da = new SqlDataAdapter(sql, cc.conn); DataSet ds = new DataSet(); da.Fill(ds, "学院hjh"); comboBox1.ValueMember = "学院hjh.学院编号hjh"; comboBox1.DataSource = ds; comboBox1.DisplayMember = "学院hjh.学院名称hjh"; sql = "select * from 课程hjh "; SqlDataAdapter da2 = new SqlDataAdapter(sql, cc.conn); da2.Fill(ds, "课程hjh"); comboBox4.ValueMember = "课程hjh.课程编号hjh"; comboBox4.DataSource = ds; comboBox4.DisplayMember = "课程hjh.课程名称hjh"; sql = "select * from 教师hjh "; SqlDataAdapter da3 = new SqlDataAdapter(sql, cc.conn); da3.Fill(ds, "教师hjh"); comboBox5.ValueMember = "教师hjh.教师编号hjh"; comboBox5.DataSource = ds; comboBox5.DisplayMember = "教师hjh.姓名hjh"; textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }