private void Tinhtrangve_Load(object sender, EventArgs e) { try { conn = DBUtils.GetDBConnection(); conn.Open(); if (conn != null) { string getdata = "SELECT ten FROM dvesdkvethang"; MySqlCommand cmdzs = new MySqlCommand(getdata, conn); rdr = cmdzs.ExecuteReader(); while (rdr.Read()) { lstten.Items.Add(rdr.GetString("ten")); } } else { MessageBox.Show("Không có kết nối đến Server !"); } } catch (MySqlException) { conn.Close(); conn.Dispose(); MessageBox.Show("Lỗi kết nối đến server !"); } finally { if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close(); conn.Dispose(); } } }
private void BtnxacnhanADM_Click(object sender, EventArgs e) { try { conn = DBUtils.GetDBConnection(); conn.Open(); string stm = "SELECT * FROM dveslogin"; MySqlCommand cmd = new MySqlCommand(stm, conn); rdr = cmd.ExecuteReader(); while (rdr.Read()) { tendn = rdr.GetString("ten"); mk = rdr.GetString("matkhau"); if (txttendnADM.Text.Equals(tendn) && txtmatkhauADM.Text.Equals(mk)) { this.Hide(); quanlyadmin to_quanlyadmin = new quanlyadmin(); to_quanlyadmin.ShowDialog(); this.Close(); } else { MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu !"); } } } catch (Exception) { MessageBox.Show("Error"); } finally { if (conn != null) { conn.Close(); conn.Dispose(); } } }
private void Thongke_Load(object sender, EventArgs e) { conn = DBUtils.GetDBConnection(); conn.Open(); newThread_vethuong = new Thread(get_tongxe); newThread_vethuong.Start(); Thread.Sleep(1000); string[] seriesArray = { "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6" , "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12" }; //chart1.ChartAreas[0].Axes[0].MajorGrid.Enabled = false;//x axis chart1.ChartAreas[0].AxisX.Title = "Thời gian (tháng)"; chart1.ChartAreas[0].AxisX.TitleFont = new Font("Arial", 10, FontStyle.Bold); chart1.ChartAreas[0].AxisY.Title = "Số lượng xe (chiếc)"; chart1.ChartAreas[0].AxisY.TitleFont = new Font("Arial", 10, FontStyle.Bold); for (int i = 0; i < 12; i++) { chart1.Series["VÉ THÁNG"].Points.AddXY(seriesArray[i], demthang[i]); chart1.Series["VÉ THƯỜNG"].Points.AddXY(seriesArray[i], demthuong[i]); } //AddXY value in chart1 in series named as Salary chart1.Titles.Add("TỔNG DOANH SỐ THU ĐƯỢC ĐẾN THỜI ĐIỂM HIỆN TẠI"); }
private void Btnxacnhantinhtien_Click(object sender, EventArgs e) { try { conn = DBUtils.GetDBConnection(); conn.Open(); if (cbbchonloaixe.Text.Equals("Xe máy")) { if (cbbchoncachtinhtien.Text.Equals("Theo ngày")) { string updateQuery = "UPDATE dvescongthuctinhtien SET cachtinh = '" + cbbchoncachtinhtien.Text + "', giaguingay = '" + txtgiatienngay.Text + "', khunggio1 = '" + cbbchongio1.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio3 = '" + cbbchongio3.Text + "', khunggio4 = '" + cbbchongio4.Text + "', gia1 = '" + txtchontien1.Text + "', gia2 = '" + txtchontien2.Text + "', gia3 = '" + txtchontien3.Text + "', gia4 = '" + txtchontien4.Text + "' WHERE id='0'"; MySqlCommand cm1 = new MySqlCommand(updateQuery, conn); cm1.CommandText = updateQuery; cm1.Connection = conn; cm1.ExecuteNonQuery(); } else { string updateQuery = "UPDATE dvescongthuctinhtien SET cachtinh = '" + cbbchoncachtinhtien.Text + "', khunggio1 = '" + cbbchongio1.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio3 = '" + cbbchongio3.Text + "', khunggio4 = '" + cbbchongio4.Text + "', gia1 = '" + txtchontien1.Text + "', gia2 = '" + txtchontien2.Text + "', gia3 = '" + txtchontien3.Text + "', gia4 = '" + txtchontien4.Text + "', giaguingay = '" + txtgiatienngay.Text + "' WHERE id='0'"; MySqlCommand cm1 = new MySqlCommand(updateQuery, conn); cm1.CommandText = updateQuery; cm1.Connection = conn; cm1.ExecuteNonQuery(); } cbbchoncachtinhtien.Text = ""; cbbchongio1.Text = ""; cbbchongio2.Text = ""; cbbchongio3.Text = ""; cbbchongio4.Text = ""; txtchontien1.Text = ""; txtchontien2.Text = ""; txtchontien3.Text = ""; txtchontien4.Text = ""; cbbchonloaixe.Text = ""; txtgiatienngay.Text = ""; MessageBox.Show("Đã lưu cách tính tiền cho xe máy"); } else if (cbbchonloaixe.Text.Equals("Xe ô tô")) { if (cbbchoncachtinhtien.Text.Equals("Theo ngày")) { string updateQuery = "UPDATE dvescongthuctinhtien SET cachtinh = '" + cbbchoncachtinhtien.Text + "', giaguingay = '" + txtgiatienngay.Text + "', khunggio1 = '" + cbbchongio1.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio3 = '" + cbbchongio3.Text + "', khunggio4 = '" + cbbchongio4.Text + "', gia1 = '" + txtchontien1.Text + "', gia2 = '" + txtchontien2.Text + "', gia3 = '" + txtchontien3.Text + "', gia4 = '" + txtchontien4.Text + "' WHERE id='1'"; MySqlCommand cm1 = new MySqlCommand(updateQuery, conn); cm1.CommandText = updateQuery; cm1.Connection = conn; cm1.ExecuteNonQuery(); } else { string updateQuery = "UPDATE dvescongthuctinhtien SET cachtinh = '" + cbbchoncachtinhtien.Text + "', khunggio1 = '" + cbbchongio1.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio3 = '" + cbbchongio3.Text + "', khunggio4 = '" + cbbchongio4.Text + "', gia1 = '" + txtchontien1.Text + "', gia2 = '" + txtchontien2.Text + "', gia3 = '" + txtchontien3.Text + "', gia4 = '" + txtchontien4.Text + "', giaguingay = '" + txtgiatienngay.Text + "' WHERE id='1'"; MySqlCommand cm1 = new MySqlCommand(updateQuery, conn); cm1.CommandText = updateQuery; cm1.Connection = conn; cm1.ExecuteNonQuery(); } txtgiatienngay.Text = ""; cbbchoncachtinhtien.Text = ""; cbbchongio1.Text = ""; cbbchongio2.Text = ""; cbbchongio3.Text = ""; cbbchongio4.Text = ""; txtchontien1.Text = ""; txtchontien2.Text = ""; txtchontien3.Text = ""; txtchontien4.Text = ""; cbbchonloaixe.Text = ""; MessageBox.Show("Đã lưu cách tính tiền cho xe ô tô"); } else if (cbbchonloaixe.Text.Equals("Xe đạp")) { if (cbbchoncachtinhtien.Text.Equals("Theo ngày")) { string updateQuery = "UPDATE dvescongthuctinhtien SET cachtinh = '" + cbbchoncachtinhtien.Text + "', giaguingay = '" + txtgiatienngay.Text + "', khunggio1 = '" + cbbchongio1.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio3 = '" + cbbchongio3.Text + "', khunggio4 = '" + cbbchongio4.Text + "', gia1 = '" + txtchontien1.Text + "', gia2 = '" + txtchontien2.Text + "', gia3 = '" + txtchontien3.Text + "', gia4 = '" + txtchontien4.Text + "' WHERE id='2'"; MySqlCommand cm1 = new MySqlCommand(updateQuery, conn); cm1.CommandText = updateQuery; cm1.Connection = conn; cm1.ExecuteNonQuery(); } else { string updateQuery = "UPDATE dvescongthuctinhtien SET cachtinh = '" + cbbchoncachtinhtien.Text + "', khunggio1 = '" + cbbchongio1.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio2 = '" + cbbchongio2.Text + "', khunggio3 = '" + cbbchongio3.Text + "', khunggio4 = '" + cbbchongio4.Text + "', gia1 = '" + txtchontien1.Text + "', gia2 = '" + txtchontien2.Text + "', gia3 = '" + txtchontien3.Text + "', gia4 = '" + txtchontien4.Text + "', giaguingay = '" + txtgiatienngay.Text + "' WHERE id='2'"; MySqlCommand cm1 = new MySqlCommand(updateQuery, conn); cm1.CommandText = updateQuery; cm1.Connection = conn; cm1.ExecuteNonQuery(); } txtgiatienngay.Text = ""; cbbchoncachtinhtien.Text = ""; cbbchongio1.Text = ""; cbbchongio2.Text = ""; cbbchongio3.Text = ""; cbbchongio4.Text = ""; txtchontien1.Text = ""; txtchontien2.Text = ""; txtchontien3.Text = ""; txtchontien4.Text = ""; cbbchonloaixe.Text = ""; MessageBox.Show("Đã lưu cách tính tiền cho xe đạp"); } conn.Close(); conn.Dispose(); //MessageBox.Show("theo ngay"); } catch (Exception) { conn.Close(); conn.Dispose(); } }
private void Btnxacnhan_Click(object sender, EventArgs e) { // đọc tagid từ reader try { if (stcomport.Equals(1)) { DateTime aDateTime = DateTime.Now; //thangdk = aDateTime.ToString("MM"); //namdk = aDateTime.ToString("yyyy"); //thanghh = Int32.Parse(thangdk); //ngaydangky = aDateTime.ToString(); //ngayhethan = ngaydangky; txtngaydangky.Text = aDateTime.ToString("dd/M/yyyy hh:mm tt"); //MessageBox.Show(txtngaydangky.Text); txtngayhethan.Text = aDateTime.AddMonths(1).ToString("dd/M/yyyy hh:mm tt"); conn = DBUtils.GetDBConnection(); conn.Open(); if (!txttagid.Text.Equals("") && !txthoten.Text.Equals("") && !txtdiachi.Text.Equals("") && !txtbienso.Text.Equals("") && !txttien.Text.Equals("") && !txtngaydangky.Text.Equals("") && !txtngayhethan.Text.Equals("")) { string[] thang = txtngaydangky.Text.Split('/'); var comm = conn.CreateCommand(); comm.CommandText = "INSERT INTO dvesdkvethang(ten, tagid, bienso, loaixe, ngaydangky, ngayhethan, tien, thang) VALUES(@ten, @id, @bx, @xe, @start, @stop, @tien,@thang)"; comm.Parameters.AddWithValue("@ten", txthoten.Text); comm.Parameters.AddWithValue("@id", txttagid.Text); comm.Parameters.AddWithValue("@bx", txtbienso.Text); comm.Parameters.AddWithValue("@xe", chonxe); comm.Parameters.AddWithValue("@start", txtngaydangky.Text); comm.Parameters.AddWithValue("@stop", txtngayhethan.Text); comm.Parameters.AddWithValue("@tien", txttien.Text); comm.Parameters.AddWithValue("@thang", thang[1]); comm.ExecuteNonQuery(); DialogResult dialogResult = MessageBox.Show("Đã đồng ý với thông tin người dùng ?", "Đăng ký người dùng mới", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close(); conn.Dispose(); } this.Hide(); giaodienchinh to_giaodienchinh = new giaodienchinh(); to_giaodienchinh.ShowDialog(); this.Close(); } else if (dialogResult == DialogResult.No) { //do something else } } else { MessageBox.Show("Đăng ký không thành công, điền đầy đủ thông tin !"); } } else { MessageBox.Show("Vui lòng kết nối đến USB COM"); } } catch (MySqlException) { conn.Close(); conn.Dispose(); MessageBox.Show("Đăng ký không thành công, lỗi kết nối đến server !"); } }
private void Btngiahan_Click(object sender, EventArgs e) { try { conn = DBUtils.GetDBConnection(); conn.Open(); if (conn != null && !txttagid.Text.Equals("")) { string getdata = "SELECT * FROM dvesdkvethang"; MySqlCommand cmdzs = new MySqlCommand(getdata, conn); rdr = cmdzs.ExecuteReader(); while (rdr.Read()) { if (txttagid.Text.Equals(rdr.GetString("tagid"))) { txtten.Text = rdr.GetString("ten"); txtbienso.Text = rdr.GetString("bienso"); stttagid = 1; rdr.Close(); break; } } rdr.Close(); DateTime aDateTime = DateTime.Now; txtngaygiahan.Text = aDateTime.ToString(); txtngayghtieptheo.Text = aDateTime.AddMonths(1).ToString(); if (conn != null && stttagid == 1) { if (txttien.Text.Equals("")) { MessageBox.Show("Vui lòng nhập số tiền đã thu!"); } else { string updateQuery = "UPDATE dvesdkvethang SET ngaydangky = '" + txtngaygiahan.Text + "', ngayhethan = '" + txtngayghtieptheo.Text + "',tien = '" + txttien.Text + "' WHERE tagid = '" + txttagid.Text + "' "; MySqlCommand cmdupdate = new MySqlCommand(updateQuery, conn); cmdupdate.CommandText = updateQuery; cmdupdate.Connection = conn; cmdupdate.ExecuteNonQuery(); MessageBox.Show("Gia hạn thành công!"); } } } else { MessageBox.Show("Không có kết nối đến server hoặc quét thẻ cần gia hạn !"); } } catch (MySqlException ex) { conn.Close(); conn.Dispose(); MessageBox.Show("Lỗi kết nối đến server !"); } finally { //MessageBox.Show("**************"); if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close(); conn.Dispose(); } this.Hide(); giaodienchinh to_giaodienchinh = new giaodienchinh(); to_giaodienchinh.ShowDialog(); this.Close(); } }
// ***************** HÀM XỬ LÝ KHI CÓ THẺ QUẸT VÀO/RA ************************************* private void IN_read_tagid() { try { conn = DBUtils.GetDBConnection(); conn.Open(); //MessageBox.Show("LOOP"); while (statuscomport == 1) { MethodInvoker mi = delegate() { // ************ XỬ LÝ XE VÀO ****************** if (sttbutton_in == 1) // CÓ THẺ QUẸT { checkvethang_in = 0; flag_in = 0; if (txtmathevao.Text != "" && txtbiensovao.Text != "") { // MessageBox.Show("thread"); DateTime aDateTime = DateTime.Now; if (conn != null) { string getdata = "SELECT * FROM dvesdkvethang"; MySqlCommand cmdzs = new MySqlCommand(getdata, conn); rdr = cmdzs.ExecuteReader(); while (rdr.Read()) { if (txtmathevao.Text.Equals(rdr.GetString("tagid"))) { MessageBox.Show("trùng vé tháng"); //mathe.Text = ""; bienso.Text = ""; lbtimeinhethan.Visible = true; txttimeinhethan.Visible = true; //bienso.Text = rdr.GetString("bienso"); txttimevao.Text = aDateTime.ToString("dd/M/yyyy hh:mm tt"); lbloaivevao.Text = "Vé tháng"; txttimeinhethan.Text = rdr.GetString("ngayhethan"); checkvethang_in = 1; rdr.Close(); break; } //else { rdr.Close(); break; } //**** PHẢI CLOSE command đã gọi trước đó để khi khởi tạo các command sau không bị chồng } rdr.Close(); if (checkvethang_in != 1 && flag_in == 0) // ** KHI MÃ THẺ KHÔNG PHẢI VÉ THÁNG ** { lbtimeinhethan.Visible = false; txttimeinhethan.Visible = false; flag_in = 1; txttimevao.Text = aDateTime.ToString("dd/M/yyyy hh:mm tt"); string[] thang = txttimevao.Text.Split('/'); var insertvethuong = conn.CreateCommand(); insertvethuong.CommandText = "INSERT INTO dvesvetrongngay (tagid, bienso, loaixe,loaive, thoigianvao,hinhanhvao,thang) VALUES (@id, @bx, @xe,@ve, @start, @imgvao,@thang)"; //insertvethuong.CommandText = "insert into dvesvetrongngay (tagid,bienso,loaixe,loaive,thoigianvao,hinhanhvao,thoigianra,hinhanhra,tien) values('" + mathe.Text + "','" + mathe.Text + "','" + mathe.Text + "','" + mathe.Text + "','" + mathe.Text + "','" + mathe.Text + "','" + mathe.Text + "','" + mathe.Text + "','" + mathe.Text + "');"; insertvethuong.Parameters.AddWithValue("@id", txtmathevao.Text); insertvethuong.Parameters.AddWithValue("@bx", txtbiensovao.Text); insertvethuong.Parameters.AddWithValue("@xe", "xe máy"); insertvethuong.Parameters.AddWithValue("@ve", "vé thường"); insertvethuong.Parameters.AddWithValue("@start", txttimevao.Text); insertvethuong.Parameters.AddWithValue("@imgvao", "link ảnh vào"); insertvethuong.Parameters.AddWithValue("@thang", thang[1]); insertvethuong.ExecuteNonQuery(); MessageBox.Show("Vé thường ----"); } } else { MessageBox.Show("Không có kết nối đến Server, đang kết nối lại ..."); conn = DBUtils.GetDBConnection(); conn.Open(); } } sttbutton_in = 0; Thread.Sleep(1000); txtmathevao.Text = ""; txtbiensovao.Text = ""; txttimevao.Text = ""; } // ********************* XỬ LÝ XE RA ************************************ if (sttbutton_out == 1) { checkvethang_out = 0; flag_out = 0; if (txtmathera.Text != "" && txtbiensora.Text != "") { // MessageBox.Show("thread"); DateTime aDateTime = DateTime.Now; if (conn != null) { //************************************************************ string getdata = "SELECT * FROM dvesdkvethang"; MySqlCommand cmdzs = new MySqlCommand(getdata, conn); rdr = cmdzs.ExecuteReader(); while (rdr.Read()) { if (txtmathera.Text == (rdr.GetString("tagid"))) { MessageBox.Show("VÉ THÁNG"); lbtimeouthethan.Visible = true; txttimeouthethan.Visible = true; txttimera.Text = aDateTime.ToString("dd/M/yyyy hh:mm tt"); lbloaivera.Text = "Vé tháng"; txttimeouthethan.Text = rdr.GetString("ngayhethan"); checkvethang_out = 1; rdr.Close(); break; } //else { rdr.Close(); break; } //**** PHẢI CLOSE command đã gọi trước đó để khi khởi tạo các command sau không bị chồng } rdr.Close(); if (checkvethang_out != 1 && flag_out == 0) // ** KHI MÃ THẺ KHÔNG PHẢI VÉ THÁNG ** { lbtimeouthethan.Visible = false; txttimeouthethan.Visible = false; // ************************** TÍNH TIỀN CHO VÉ THƯỜNG THEO TỪNG LOẠI XE VÀ THEO CÔNG THỨC TÍNH TIỀN ****************************** // TÍNH THEO NGÀY VÀ TÍNH THEO KHUNG GIỜ string gettien = "SELECT * FROM dvescongthuctinhtien"; MySqlCommand cmdtien = new MySqlCommand(gettien, conn); rdr = cmdtien.ExecuteReader(); while (rdr.Read()) { MessageBox.Show("TÍNH TIỀN XE" + " " + checkoto + " " + rdr.GetString("loai xe")); if ((checkxemay == 1) && (rdr.GetString("loai xe") == "Xe máy")) // TÍNH THEO NGÀY { tiengui = rdr.GetString("giaguingay"); //MessageBox.Show("XE MÁY --------"); rdr.Close(); break; } else if ((checkoto == 1) && (rdr.GetString("loai xe") == "Xe ô tô")) // TÍNH THEO NGÀY { tiengui = rdr.GetString("giaguingay"); //MessageBox.Show("XE Ô TÔ --------"); rdr.Close(); break; } else if ((checkxedap == 1) && (rdr.GetString("loai xe") == "Xe đạp")) // TÍNH THEO NGÀY { tiengui = rdr.GetString("giaguingay"); //MessageBox.Show("XE ĐẠP --------"); rdr.Close(); break; } //else { rdr.Close(); break; } //**** PHẢI CLOSE command đã gọi trước đó để khi khởi tạo các command sau không bị chồng } rdr.Close(); // ********************************************************* // *** KIỂM TRA DATABASE VÉ THƯỜNG ***** string getvethuong = "SELECT * FROM dvesvetrongngay"; MySqlCommand cmdvethuong = new MySqlCommand(getvethuong, conn); rdr = cmdvethuong.ExecuteReader(); while (rdr.Read()) { if (txtmathera.Text == (rdr.GetString("tagid"))) { flag_out = 1; sttsaive = 1; txttimera.Text = aDateTime.ToString("dd/M/yyyy hh:mm tt"); lbloaivera.Text = "Vé thường"; txttienra.Text = tiengui; MessageBox.Show("VÉ THƯỜNG"); rdr.Close(); break; } //else { sttsaive = 1; } //**** PHẢI CLOSE command đã gọi trước đó để khi khởi tạo các command sau không bị chồng } rdr.Close(); if (flag_out == 1) { flag_out = 0; string updateQuery = "UPDATE dvesvetrongngay SET thoigianra = '" + txttimera.Text + "', hinhanhra = 'link ảnh ra', tien = '" + tiengui + "' WHERE tagid = '" + txtmathera.Text + "' "; MySqlCommand cmdupdate = new MySqlCommand(updateQuery, conn); cmdupdate.CommandText = updateQuery; cmdupdate.Connection = conn; cmdupdate.ExecuteNonQuery(); } if (sttsaive != 1) { flag_out = 0; MessageBox.Show("SAI VÉ!"); //sttsaive = 0; } } } else { MessageBox.Show("Không có kết nối đến Server, đang kết nối lại ..."); conn = DBUtils.GetDBConnection(); conn.Open(); } } sttbutton_out = 0; Thread.Sleep(1000); txtmathevao.Text = ""; txtbiensovao.Text = ""; txttimevao.Text = ""; txttienra.Text = ""; } }; this.Invoke(mi); } Thread.Sleep(2000); conn.Close(); conn.Dispose(); } catch (Exception) { conn.Close(); conn.Dispose(); //Application.Exit(); } }
private void Picsearch_Click(object sender, EventArgs e) { try { conn = DBUtils.GetDBConnection(); conn.Open(); if (conn != null && !txtbienso.Text.Equals("") && !giovaonhap.Equals("")) { string getdata = "SELECT * FROM dvesvetrongngay"; MySqlCommand cmdzs = new MySqlCommand(getdata, conn); rdr = cmdzs.ExecuteReader(); while (rdr.Read()) { // MessageBox.Show(rdr.GetString("bienso")); if (txtbienso.Text.Equals(rdr.GetString("bienso"))) { giovaolay = rdr.GetString("thoigianvao"); String[] thoigianlay = giovaolay.Split(' '); String[] thoigiannhap = giovaonhap.Split(' '); //MessageBox.Show(giovaolay); if ((thoigianlay[0] == thoigiannhap[0])) { // Hiển thị hình ảnh xe vào và xe ra *************** MessageBox.Show("Biến số xe hợp lệ"); lbvao.Visible = true; picvao.Visible = true; lbra.Visible = true; picra.Visible = true; rdr.Close(); break; } else { MessageBox.Show("Giờ vào không đúng"); rdr.Close(); break; } } } } else { MessageBox.Show("Không có kết nối đến Server !"); } } catch (MySqlException) { conn.Close(); conn.Dispose(); MessageBox.Show("Lỗi kết nối đến server !"); Application.Exit(); } finally { if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close(); conn.Dispose(); } } }