I'm not entirely clear what you think you're doing with what you've written.
What is in TextBox1? (By the way, you should really set your own names for the controls so it's clear...like
txtEmpNo
. Then, others wouldn't have to guess...nor would you in the future).
Secondly, it doesn't look like you understand databases or how to extract information from them. I assume this is what you want:
A person types in an Employee Number. Then, you go into the database and see if it's valid. If it is, then you get the information about that employee.
So, you need to actually look into SQL and what is available. First, you need to specify a "WHERE" paramater if you want to search for something specific. Secondly, I would look at the SQLCommand.ExecuteScalar method. This will return only the first column and the first row of the query. So, if your query said
SELECT dayNumber FROM JulianCalendar WHERE (Month=3 AND Day=2 AND Year=2007)
it would return "2454162" if there was a match in the database or
Nothing
You also don't set a
SELECT
string on your button click to set the DataBindings...and really, I wouldn't even use DataBindings. I would just fill the table with the select, which should only give you one row and then just fill the TextBox values with what is in the columns.
You're going about this task all wrong.