One way is to load the data into a
DataTable
/
DataSet
(you say you know how to do this) in the
Form.Load
event.
Then, still in Form.Load, get the value you want to use, ID say or Name, from each record and use that value as the
Text
of each button. Then dispose of the DataTable/DataSet.
Then when a button is clicked use a
parameterized query[
^] (scroll down till you hit the
Select section.)
The main difference in your situation is that you would use
cmd.Parameters.AddWithValue("ID", Button.Text);
Hope this helps. :)