private void employees_Load(object sender, EventArgs e) { con.OpenConection(); SqlCommand com = new SqlCommand("select emp_id,name from employee", con.con); SqlDataReader dr = com.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dr); dataGridView1.DataSource = dt; dr.Close(); con.CloseConnection(); }
private void عرض_موظفى_العلاج_الطبيعي_Load(object sender, EventArgs e) { try { con.OpenConection(); object x = new object(); x = con.ShowDataInGridView("physiotherapy_Doctors_select"); dataGridView1.DataSource = (DataTable)x; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.CloseConnection(); } }
private void button4_Click(object sender, EventArgs e) { con.OpenConection(); string query = @"SELECT applicant_data.applicant_name, applicant_data.applicant_date, applicant_data.gender, applicant_data.courses, applicant_data.languages, applicant_data.experince_years, applicant_data.qualifications, applicant_data.job_name, applicant_data.nationality, interview.interviewer_name, interview.interview_date, interview.interview_evaluate FROM applicant_data INNER JOIN interview ON applicant_data.applicant_id = interview.applicant_id WHERE applicant_data.applicant_name='" + textBox1.Text + "'"; dataGridView1.DataSource = (DataTable)con.ShowDataInGridView(query); con.CloseConnection(); }
//////////////////////////////////save///////////////////////////// private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (tableLayoutPanel1.RowCount > 1) { l1.Add(t1.Text); l1.Add(t2.Text); l1.Add(t3.Text); l1.Add(t4.Text); l1.Add(check.Checked.ToString()); } if (tableLayoutPanel1.RowCount == 1) { l1.Add(textBox1.Text); l1.Add(textBox2.Text); l1.Add(textBox3.Text); l1.Add(textBox4.Text); l1.Add(checkBox1.Checked.ToString()); } for (int i = 0; i < l1.Count; i += 5) { //texts[i] = l1[i]; /*create procedure clinic_غرف_العيادات_الخارجية_room_insert(@r int,@arabic nvarchar(100),@english nvarchar(100),@sep nvarchar(100),@main nvarchar(100)) * as * begin * insert into room(r_id,arabic_des,english_des,specialty,maintenance) values(@r,@arabic,@english,@sep,@main) * end */ //con.Open(); //cmd.Connection = con; ////cmd.CommandText = "insert into room(r_id,arabic_des,english_des,specialty,maintenance) values('" + l1[i] + "','" + l1[i + 1] + "','" + l1[i + 2] + "','" + l1[i + 3] + "','" + l1[i + 4] + "')"; //cmd.CommandText = "clinic_غرف_العيادات_الخارجية_room_insert"; //cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@r", SqlDbType.Int).Value = l1[i]; //cmd.Parameters.Add("@arabic", SqlDbType.NVarChar).Value = l1[i + 1]; //cmd.Parameters.Add("@english", SqlDbType.NVarChar).Value = l1[i + 2]; //cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = l1[i + 3]; //cmd.Parameters.Add("@main", SqlDbType.NVarChar).Value = l1[i + 4]; //cmd.ExecuteNonQuery(); //con.Close(); con1.OpenConection(); types = new SqlDbType[] { SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar }; name_input = new string[] { "@r", "@arabic", "@english", "@sep", "@main" }; values = new string[] { l1[i], l1[i + 1], l1[i + 2], l1[i + 3], l1[i + 4] }; con1.ExecuteNonQueryProcedure("clinic_غرف_العيادات_الخارجية_room_insert", name_input, values, types); con1.CloseConnection(); } //con.OpenConection(); //con.ShowDataInGridViewUsingStoredProc("clinic_غرف_العيادات_الخارجية_room_insert", inputs, texts, types); MessageBox.Show("تم الحفظ"); l1.Clear(); }
private void judgement_Load(object sender, EventArgs e) { ((first)this.MdiParent).menuStrip1.Visible = false; sqlCon.OpenConection(); try { object dt = sqlCon.ShowDataInGridViewUsingStoredProc("asset_get_ex_no"); DataTable dtt = (DataTable)dt; int code = 0; if (dtt.Rows.Count != 0) { code = Convert.ToInt32(dtt.Rows[0][0]) + 1; } else { code = 1; } label7.Text = code.ToString(); ///////////////////// String[] a = { "@ex_no" }; String[] b = { code.ToString() }; SqlDbType[] c = { SqlDbType.Int }; sqlCon.ExecuteInsertOrUpdateOrDeleteUsingStoredProc("insert_ex_no", a, b, c); comboBox4.DataSource = sqlCon.ShowDataInGridViewUsingStoredProc("asset_get_bills"); comboBox4.DisplayMember = "bill_id"; comboBox4.ValueMember = "bill_id"; comboBox2.DataSource = sqlCon.ShowDataInGridViewUsingStoredProc("asset_get_command_supply"); comboBox2.DisplayMember = "commandsupply_id"; comboBox2.ValueMember = "commandsupply_id"; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sqlCon.CloseConnection(); } }
private void تعديل_بيانات_خروج_مريض_Load(object sender, EventArgs e) { con.OpenConection(); cmd = new SqlCommand("data_of_patient"); try { cmd.Connection = con.con; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@pa_id", id); var k = cmd.Parameters.Add("@pa_id22", SqlDbType.Int); k.Direction = ParameterDirection.Output; var a = cmd.Parameters.Add("@direc", SqlDbType.VarChar, 40); a.Direction = ParameterDirection.Output; var b = cmd.Parameters.Add("@nationality", SqlDbType.VarChar, 40); b.Direction = ParameterDirection.Output; var c = cmd.Parameters.Add("@gender", SqlDbType.VarChar, 40); c.Direction = ParameterDirection.Output; var n = cmd.Parameters.Add("@age", SqlDbType.Int); n.Direction = ParameterDirection.Output; var f = cmd.Parameters.Add("@date_Re", SqlDbType.VarChar, 40); f.Direction = ParameterDirection.Output; var g = cmd.Parameters.Add("@birth_date", SqlDbType.VarChar, 40); g.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); textBox20.Text = f.Value.ToString(); textBox18.Text = b.Value.ToString(); textBox17.Text = a.Value.ToString(); textBox19.Text = c.Value.ToString(); textBox21.Text = g.Value.ToString(); textBox20.Text = n.Value.ToString(); textBox16.Text = k.Value.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } cmd.Connection.Close(); con.CloseConnection(); }
private void show_Click(object sender, EventArgs e) { con.OpenConection(); cmd = new SqlCommand("show_budget", con.con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("month", comboMonth.Text); cmd.Parameters.AddWithValue("year", comboYear.Text); // cmd = new MySqlCommand("select serial_num as 'رقم المسلسل' ,expense as 'المنصرف من الاعتماد' ,credit_value as 'قيمة الاعتماد',particular_authorityFrom as 'الجهة المختصة : من',particular_authorityTo as'الى',item_id as 'رقم البند',it_name as 'اسم البند',doc_entryDate as 'تاريخ دخول المستند' from book_budget where MONTH(doc_entryDate)='" + comboMonth.Text + "' and YEAR(doc_entryDate)='" + comboYear.Text+ "' order by DAY(doc_entryDate);", con); try { dr = cmd.ExecuteReader(); dt = new DataTable(); dt.Load(dr); dataGridView1.DataSource = dt; } catch (Exception ee) { MessageBox.Show(ee.Message); } con.CloseConnection(); }
private void عرض_خدمات_الغسيل_الكلوى_Load(object sender, EventArgs e) { try { con.OpenConection(); dataGridView1.DataSource = con.ShowDataInGridView("Hemodialysis_services_select"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } con.CloseConnection(); }
private void Form21_Load(object sender, EventArgs e) { con.OpenConection(); dataGridView1.DataSource = con.ShowDataInGridViewUsingStoredProc("t11"); con.CloseConnection(); //SqlCommand cmd = new SqlCommand("t11", con); //cmd.CommandType = CommandType.StoredProcedure; //da = new SqlDataAdapter(cmd); //SqlCommandBuilder cb = new SqlCommandBuilder(da); //ds = new DataSet(); //da.Fill(ds); //dataGridView1.DataSource = ds.Tables[0]; }
private void listBox1_MouseClick(object sender, MouseEventArgs e) { con.OpenConection(); string[] pramname2 = new string[1]; string[] pramvalue2 = new string[1]; SqlDbType[] pramtype2 = new SqlDbType[1]; pramname2[0] = "@x1"; pramvalue2[0] = listBox1.SelectedItem.ToString(); pramtype2[0] = SqlDbType.VarChar; //con.OpenConection(); listBox2.DataSource = con.ShowDataInGridViewUsingStoredProc("MedicalSheet_NewHeader_headerselect", pramname2, pramvalue2, pramtype2); con.CloseConnection(); }
private void button1_Click(object sender, EventArgs e) { Label type = new Label(); type.Location = new Point(265, 85); type.Size = new Size(100, 20); type.Name = "type"; type.Text = "الاساسي"; groupBox1.Controls.Add(type); value1.Location = new Point(140, 85); value1.Size = new Size(100, 20); value1.Name = "value1"; value1.ReadOnly = true; groupBox1.Controls.Add(value1); con.OpenConection(); try { value1.Text = ""; SqlCommand cmd = new SqlCommand(); con.OpenConection(); cmd.CommandText = ("SELECT top 1 base_salary FROM salary ,employee where name = '" + comboBox1.Text + "' and salary.emp_id = employee.emp_id order by _date DESC"); cmd.Connection = con.con; value1.Text = cmd.ExecuteScalar().ToString();; MessageBox.Show("تم البحث بنجاح"); } catch (Exception) { MessageBox.Show(" خطأ في اللادخال "); value1.Text = ""; } con.CloseConnection(); }
private void عرض_المرضى_للغسل_الكلوى_Load(object sender, EventArgs e) { try { con.OpenConection(); dataGridView1.DataSource = con.ShowDataInGridView("Registeration_patientRegisteration_select3"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } con.CloseConnection(); }
private void btn_name_Click(object sender, EventArgs e) { try { con.OpenConection(); string[] s = new string[] { "@patientname" }; string[] s1 = new string[] { txt_patiant_name.Text }; SqlDbType[] s3 = new SqlDbType[] { SqlDbType.NVarChar }; patient_data.DataSource = (DataTable)con.ShowDataInGridViewUsingStoredProc("ManageFilesPatientdata", s, s1, s3); ///////////////////////////////////////////////////////////////////////// string[] s4 = new string[] { "@patientname" }; string[] s5 = new string[] { txt_patiant_name.Text }; SqlDbType[] s6 = new SqlDbType[] { SqlDbType.NVarChar }; DataTable d = new DataTable(); examination.DataSource = (DataTable)con.ShowDataInGridViewUsingStoredProc("ManageFilesPatientProcess", s4, s5, s6); con.CloseConnection(); } catch (Exception ee) { MessageBox.Show(ee.Message); } }
private void البحث_بالمجموعه_Load(object sender, EventArgs e) { dataGridView1.DefaultCellStyle.Font = new Font("Calibri", 10.25f, FontStyle.Regular); dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Calibri", 11, FontStyle.Regular); dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.RoyalBlue; dataGridView1.EnableHeadersVisualStyles = false; dataGridView1.BorderStyle = 0; dataGridView1.RowHeadersVisible = false; dataGridView1.BackgroundColor = Color.White; con.OpenConection(); con.DataReader("groups_select_All"); dataGridView1.DataSource = con.ShowDataInGridView("groups_select_All"); con.CloseConnection(); }
private void button2_Click(object sender, EventArgs e) { con.OpenConection(); cmd = new SqlCommand("select emp_id as 'كود الموظف' ,name as'اسم الموظف',career_name as 'الوظيفة' from employee where emp_id=@x", con.con); cmd.Parameters.AddWithValue("@x", textBox1.Text); SqlDataReader dr = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dr); dataGridView1.DataSource = dt; dr.Close(); con.CloseConnection(); }
private void button1_Click(object sender, EventArgs e) { try { sqlCon.OpenConection(); String[] a = { "@t", "@c", "@ar", "@la", "@flag" }; String[] b = { "asset_re_evaluation_reasons", "0", textBox2.Text, textBox3.Text, "0" }; if (textBox1.Text != "") { b[4] = "1"; b[1] = textBox1.Text; } SqlDbType[] c = { SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Int }; dataGridView1.DataSource = sqlCon.ShowDataInGridViewUsingStoredProc("search_conditional1", a, b, c); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sqlCon.CloseConnection(); } }
private void القاعات_Load(object sender, EventArgs e) { try { con.OpenConection(); dataGridView1.DataSource = con.ShowDataInGridView("Room_selects"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } con.CloseConnection(); }
private void button1_Click(object sender, EventArgs e) { con.OpenConection(); if (textBox2.TextLength != 0 && textBox3.TextLength != 0) { SqlCommand com = new SqlCommand("insert_off_vac", con.con); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("name", textBox2.Text); com.Parameters.AddWithValue("start_date", dateTimePicker1.Value.Date.ToString("yyyy-MM-dd HH:mm")); com.Parameters.AddWithValue("end_date", dateTimePicker2.Value.Date.ToString("yyyy-MM-dd HH:mm")); com.Parameters.AddWithValue("length", textBox3.Text); com.ExecuteNonQuery(); MessageBox.Show("تم إضافة الأجازة"); } else { MessageBox.Show("الرجاء ادخال اسم الأجازة"); } con.CloseConnection(); }
public void display() { try { con.OpenConection(); dataGridView1.DataSource = (DataTable)con.ShowDataInGridViewUsingStoredProc("rel_religion"); con.CloseConnection(); } catch (Exception s) { MessageBox.Show(s.Message); } }
private void Form13_Load(object sender, EventArgs e) { /*dataGridView1.DataSource = null; * ds.Tables.Clear(); * dataGridView1.Rows.Clear(); * dataGridView1.Refresh(); * da = new sqlDataAdapter("select * from subactor", "server=localhost;database=final;uid=root;pwd=root"); * sqlCommandBuilder cb = new sqlCommandBuilder(da); * da.Fill(ds); * dataGridView1.DataSource = ds.Tables[0];*/ try { con.OpenConection(); dataGridView1.DataSource = con.ShowDataInGridViewUsingStoredProc("data_subactor"); con.CloseConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.CloseConnection(); } }
private void Form22_Load(object sender, EventArgs e) { try { con.OpenConection(); dataGridView1.DataSource = con.ShowDataInGridViewUsingStoredProc("bill_show"); con.CloseConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.CloseConnection(); } //dataGridView1.DataSource = null; //ds.Tables.Clear(); //dataGridView1.Rows.Clear(); //dataGridView1.Refresh(); //da = new SqlDataAdapter("bill_show", con); //SqlCommandBuilder cb = new SqlCommandBuilder(da); //da.Fill(ds); //dataGridView1.DataSource = ds.Tables[0]; }
private void التصفيه_الماليه_لخروج_مريض_Load(object sender, EventArgs e) { con.OpenConection(); SqlCommand cmd = new SqlCommand("settle_finance", con.con); try { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@pa_id", id); var k = cmd.Parameters.Add("@pa_id22", SqlDbType.Int); k.Direction = ParameterDirection.Output; var a = cmd.Parameters.Add("@direc", SqlDbType.VarChar, 40); a.Direction = ParameterDirection.Output; var b = cmd.Parameters.Add("@nationality", SqlDbType.VarChar, 40); b.Direction = ParameterDirection.Output; var c = cmd.Parameters.Add("@gender", SqlDbType.VarChar, 40); c.Direction = ParameterDirection.Output; var n = cmd.Parameters.Add("@age", SqlDbType.VarChar, 40); n.Direction = ParameterDirection.Output; var f = cmd.Parameters.Add("@date_Re", SqlDbType.VarChar, 40); f.Direction = ParameterDirection.Output; var g = cmd.Parameters.Add("@birth_date", SqlDbType.VarChar, 40); g.Direction = ParameterDirection.Output; var ll = cmd.Parameters.Add("@nu_station", SqlDbType.VarChar, 40); ll.Direction = ParameterDirection.Output; var lm = cmd.Parameters.Add("@n_of_room", SqlDbType.VarChar, 40); lm.Direction = ParameterDirection.Output; var lo = cmd.Parameters.Add("@cat_id", SqlDbType.VarChar, 40); lo.Direction = ParameterDirection.Output; var lu = cmd.Parameters.Add("@pa_name", SqlDbType.VarChar, 40); lu.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); textBox12.Text = f.Value.ToString(); textBox7.Text = k.Value.ToString(); textBox8.Text = a.Value.ToString(); textBox9.Text = b.Value.ToString(); textBox10.Text = c.Value.ToString(); textBox15.Text = g.Value.ToString(); textBox14.Text = n.Value.ToString(); textBox4.Text = ll.Value.ToString(); textBox3.Text = lo.Value.ToString(); textBox5.Text = lu.Value.ToString(); textBox6.Text = lm.Value.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } con.CloseConnection(); }
private void button1_Click(object sender, EventArgs e) { try { if (استقبال_العلاج_الطبيعي.ContainsArabicLetters(textBox2.Text) && استقبال_العلاج_الطبيعي.ContainsArabicLetters(textBox3.Text)) { con.OpenConection(); string[] pramname = new string[3]; string[] pramvalue = new string[3]; SqlDbType[] pramtype = new SqlDbType[3]; pramname[0] = "@Room_name"; pramname[1] = "@Room_place"; pramname[2] = "@Treatment_Duration_code"; pramvalue[0] = textBox2.Text; pramvalue[1] = textBox3.Text; pramvalue[2] = textBox1.Text; pramtype[0] = SqlDbType.VarChar; pramtype[1] = SqlDbType.VarChar; pramtype[2] = SqlDbType.Int; con.ExecuteInsertOrUpdateOrDeleteUsingStoredProc("physiotherapy_physiotherapy_Rooms_insert", pramname, pramvalue, pramtype); object x = new object(); x = con.ShowDataInGridView("physiotherapy_physiotherapy_Rooms_select"); dataGridView1.DataSource = (DataTable)x; } else { MessageBox.Show("من فضلك ادخل البيانات المطلوبة باللغة العربة "); } } catch (Exception ex) { //if (textBox1.Text.Equals("") || textBox2.Text.Equals("") || textBox3.Text.Equals("")) //{ MessageBox.Show("من فضلك ادخل البيانات كاملة"); //} } finally { con.CloseConnection(); } }
private void حفظToolStripMenuItem_Click(object sender, EventArgs e) { con.OpenConection(); try { if (textBox3.Text != "" && textBox1.Text != "" && comboBox1.Text != "") { string[] f = new string[] { "@c", "@n", "@t" }; string[] f2 = new string[] { textBox3.Text, textBox1.Text, comboBox1.Text }; SqlDbType[] f3 = new SqlDbType[] { SqlDbType.VarChar, SqlDbType.VarChar, SqlDbType.VarChar }; if (-1 == con.ExecuteInsertOrUpdateOrDeleteUsingStoredProc2("adds_emergency_services", f, f2, f3)) { MessageBox.Show("تمت اضافة هذه الخدمة من قبل "); return; } //string s = "insert into emergency_emergency_services values(@c,@n,@t);"; //cmd = new MySqlCommand(s, con); //cmd.Parameters.AddWithValue("@c", textBox3.Text); //cmd.Parameters.AddWithValue("@n", textBox1.Text); //cmd.Parameters.AddWithValue("@t", comboBox1.SelectedItem); //cmd.ExecuteNonQuery(); MessageBox.Show("تمت الاضافة بنجاح"); } else { MessageBox.Show("قم باكمال البيانات"); } } catch (Exception) { MessageBox.Show("تمت اضافة هذه الخدمة من قبل"); } con.CloseConnection(); }
private void Form43_Load(object sender, EventArgs e) { con.OpenConection(); dataGridView1.DataSource = (DataTable)con.ShowDataInGridViewUsingStoredProc("form47_se"); //cmd = new MySqlCommand("select _idee.emp_id=v.employee_id and employee.emp_id=p.employee_id and employee.emp_id=r.employee_id and employee.emp_id='" + textBox3.Text + "' and register_attending= '" + dateTimePicker2.Value.ToShortDateString() + "' ", con); //cmd = new SqlCommand("form47_se", con); //cmd.CommandType = CommandType.StoredProcedure; //SqlDataReader dr = cmd.ExecuteReader(); //DataTable dt = new DataTable(); //dt.Load(dr); //dataGridView1.DataSource = dt; //dr.Close(); con.CloseConnection(); }
private void Form38_Load(object sender, EventArgs e) { con.OpenConection(); dataGridView1.DataSource = con.ShowDataInGridViewUsingStoredProc("showcommandsupplay"); con.CloseConnection(); //dataGridView1.DataSource = null; //ds.Tables.Clear(); //dataGridView1.Rows.Clear(); //dataGridView1.Refresh(); //da = new SqlDataAdapter("select * from command_supply;", @"Server=DEMIANA\SQLEXPRESS;Database=PHIS;integrated security=true"); //SqlCommandBuilder cb = new SqlCommandBuilder(da); //da.Fill(ds); //dataGridView1.DataSource = ds.Tables[0]; }
private void عرض_الاقسام_Load(object sender, EventArgs e) { try { con.OpenConection(); con.DataReader("infection_department_select"); dataGridView1.DataSource = con.ShowDataInGridView("infection_department_select"); con.CloseConnection(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void Form23_Load(object sender, EventArgs e) { con.OpenConection(); dataGridView1.DataSource = con.ShowDataInGridViewUsingStoredProc("suppshow"); con.CloseConnection(); //dataGridView1.DataSource = null; //ds.Tables.Clear(); //dataGridView1.Rows.Clear(); //dataGridView1.Refresh(); //da = new SqlDataAdapter("select * from suppliers", "server=localhost;database=PHIS;uid=root;pwd=root"); //SqlCommandBuilder cb = new SqlCommandBuilder(da); //da.Fill(ds); //dataGridView1.DataSource = ds.Tables[0]; }
private void Form41_Load(object sender, EventArgs e) { con.OpenConection(); dataGridView1.DataSource = (DataTable)con.ShowDataInGridViewUsingStoredProc("form23_se"); ////cmd = new MySqlCommand("select _idee.emp_id=v.employee_id and employee.emp_id=p.employee_id and employee.emp_id=r.employee_id and employee.emp_id='" + textBox3.Text + "' and register_attending= '" + dateTimePicker2.Value.ToShortDateString() + "' ", con); //cmd = new MySqlCommand("select emp_id as'كود الموظف' ,name as'اسم الموظف',adm_name as 'الادارة',dep_name as 'القسم',career_name as 'الوظيفة' from employee,adminstration,department where emp_id=adminstration.employee_id and emp_id=department.employee_id", con); //MySqlDataReader dr = cmd.ExecuteReader(); //DataTable dt = new DataTable(); //dt.Load(dr); //dataGridView1.DataSource = dt; //dr.Close(); con.CloseConnection(); }
/////////////////////// private void fill_Entites() { try { comboBox1.Items.Clear(); comboBox1.Text = ""; listBox1.Items.Clear(); con.OpenConection(); query = @"SELECT CE_Id, CE_AName FROM tb_Contracting_Entities"; dr = con.DataReader(query); while (dr.Read()) { comboBox1.Items.Add(dr[0].ToString()); listBox1.Items.Add(dr[1].ToString()); } con.CloseConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }