Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string queryString = "select a.miesiace," +
- "(select ISNULL(sum(kwota), 0) from przychody c where DATEPART(month, (c.data_przychodu)) = a.miesiace" +
- "and DATEPART(YEAR, (c.data_przychodu)) = DATEPART(year, (getdate()))) -" +
- "(select ISNULL(sum(kwota), 0) from wydatki b where DATEPART(month, (b.data_zakupu)) = a.miesiace" +
- "and DATEPART(YEAR, (b.data_zakupu)) = DATEPART(year, (getdate())))";
- using (SqlConnection con1 = new SqlConnection(polaczenie_baza))
- {
- SqlCommand command = new SqlCommand(
- queryString, con1);
- con1.Open();
- SqlDataReader reader = command.ExecuteReader();
- try
- {
- while (reader.Read())
- {
- MessageBox.Show(reader.ToString());
- }
- }
- finally
- {
- reader.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment