The first thing you should do is use parameterized queries. A simple example of how to do that can be found here. As for doing a select, a basic select would look like
SELECT * FROM ChkInOut WHERE ControlNo = '12012996'
I'm assuming because you put single quotes around 12012996 that it is stored as a string rather than an int. As a parameterised query that would look like
cmd.CommandText = "SELECT * FROM ChkInOut WHERE ControlNo = @ctrlNo"
cmd.Parameters.AddWithValue("@ctrlNo",txtCtrlno.Text)
where txtCtrlNo is a text control containing the value to search for.
Reverend Jim
Carpe per diem
3,584 posts since Aug 2010
Reputation Points: 561
Solved Threads: 445
Skill Endorsements: 32