Hallo
i want to read many different commands in one method passing int year as parameter for method . the method should read 3 different commands for example 2017,2018 and 2019 .
what i have done so far is the following
What I have tried:
- public int GetSumYear(int year)
- {
- int sum = 0;
- string CS = "+++++"
- using (SqlConnection connection = new SqlConnection(CS))
- {
- connection.Open();
- SqlCommand command = new SqlCommand("select COUNT (ÜbertragenAm) from BranchSale_all where ÜbertragenAm between '2017-01-01' and '2018-01-01'", connection);
-
- sum = (int)command.ExecuteScalar();
- }
- return sum;
- }