-2

I'm having problem with my C# Windows Form Application I need to select data by time period Here's my code:

string queryAll = "SELECT * FROM EX_SUM WHERE YEAR 
BETWEEN '"+ from + "' AND '" + to + "'";

I have textboxes from and to But it not working. But when i'm write this code:

string queryAll = "SELECT * FROM EX_SUM WHERE YEAR BETWEEN '05.05.2010' and '05.05.2015' ";

it works correctly

badahboom
  • 49
  • 1
  • 7

1 Answers1

-1

If you are using a multi line string, you need to add " in the end.

string queryAll = "SELECT * FROM EX_SUM WHERE YEAR " +

"BETWEEN '"+ from + "' AND '" + to + "'";
Hossein
  • 3,083
  • 3
  • 16
  • 33
Sam
  • 19
  • 3