Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Let's say i got a datagridview with column name of first name,middle name and last name and the total item inside of my datagridview is 10 items with first name, middle name and last name and if i only selected 1 and 5 or i selected 5 and 10 i can get the 1 and 5 or 5 and 10 and those between them.

What I have tried:

i tried doing it in sql to make it easier but the data i'm handling is somewhat hindering me because i got a month and year filter and if i use a between in sql i'll print a wrong item, and my best guess is i really need to get it via datagridview not in database and print it in qrcode.
Posted
Updated 18-Sep-19 21:10pm
v2

1 solution

Quote:
my best guess is i really need to get it via datagridview not in database


You're wrong. You should work on data instead of datagridview's cells/rows!

A proper SQL statement to filter data based on year and month is:

SQL
SELECT FirstName, MiddleName, LastName
FROM yourTable
WHERE YEAR(DateOfBorn) = @ayear AND MONTH(DateOfBorn) = @amonth
 
Share this answer
 
Comments
CPallini 19-Sep-19 4:19am    
5.
Maciej Los 19-Sep-19 4:20am    
Thank you, Carlo.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900