protected bool InputErrorCheck() { // SqlConnection con = new SqlConnection("Data Source = devserver\\sql2014 ;Initial Catalog=SMS;Persist Security Info=True;User ID=sa;Password=admin12345!"); Base_DL bdl = new Base_DL(); var con = bdl.GetConnection(); con.Open(); SqlCommand cmd = new SqlCommand(" select * from D_Sales where SalesNo = '" + txtprintprogress.Text + "' AND BillingType = '1'", con); cmd.CommandTimeout = 0; SqlDataAdapter adp = new SqlDataAdapter(cmd); var furikomi = new DataTable(); adp.Fill(furikomi); con.Close(); if (furikomi.Rows.Count == 0) { bbl.ShowMessage("E138"); txtprintprogress.Focus(); return(false); } else if (furikomi.Rows.Count == 1) { if (!String.IsNullOrEmpty(furikomi.Rows[0]["DeleteDateTime"].ToString())) { bbl.ShowMessage("E140"); txtprintprogress.Focus(); return(false); } } return(true); }
public void Display_Service_Update(bool Opened) { var val = (Opened) ? "1" : "0"; Base_DL bdl = new Base_DL(); using (SqlConnection con = bdl.GetConnection()) { con.Open(); using (SqlCommand command = new SqlCommand("Update M_Multiporpose set Num1 = '" + val + "' where[Key] = '1' and Id = '326'", con)) { command.ExecuteNonQuery(); } con.Close(); } }
protected DataTable getd() { var dt = new DataTable(); var con = bdl.GetConnection(); // SqlConnection conn = new SqlConnection("Data Source=202.223.48.145;Initial Catalog=CapitalSMS;Persist Security Info=True;User ID=sa;Password=admin123456!"); SqlConnection conn = con; conn.Open(); SqlCommand command = new SqlCommand("Select Char1, Char2, Char3, Char4,Char5 from [M_Multiporpose] where [Key]='1' and Id='326'", conn); SqlDataAdapter adapter = new SqlDataAdapter(command); adapter.Fill(dt); conn.Close(); return(dt); }