public DataTable SearchBwDate(Sold_Item s) { con.Open(); string query = string.Format("SELECT profit FROM sold_records1 WHERE date between'" + s.Date + "' And '" + s.DateOne + "'"); SqlCommand cmd = new SqlCommand(query, con); DataTable dt = new DataTable(); SqlDataReader sdr; sdr = cmd.ExecuteReader(); dt.Load(sdr); con.Close(); return(dt); }
public DataTable SearchDate(Sold_Item s) { con.Open(); string query = string.Format("SELECT profit FROM sold_records1 WHERE date='{0}'", s.Date); SqlCommand cmd = new SqlCommand(query, con); // SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); // da.Fill(dt); SqlDataReader sdr; //cmd.CommandType = CommandType.Text; sdr = cmd.ExecuteReader(); dt.Load(sdr); con.Close(); return(dt); }