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);
- // here i want to read the same command for 2018 and 2019
- sum = (int)command.ExecuteScalar();
- }
- return sum;
- }

Suraj KumarRank #353 · 7.1K reputationPosted Jun 24, 2019, 5:21 AM EDT
Mario ScheerenRank #1,371 · 1.2K reputationPosted Jun 25, 2019, 10:58 PM EDT
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 25, 2019, 5:44 AM EST