Bit of a hobbyist coder (and Novice) so I appreciate I may be approaching this in the wrong way so any advice on changing my approach would also be appreciated.
The idea is to have a "More Details" button on a form, that will open another form showing the customers contact details retrieved from a SQL table. The table called 'Project_Info' contains all of the contact/address data, using a 'Project' ID as the unique identifier.
The code for the button:
private void button2_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=WIN-M9TBGRD70BU;Initial Catalog=Disk_Tracker;User ID=Tracker;Password=********");
SqlDataAdapter sda = new SqlDataAdapter("Select * FROM Project_Info WHERE (Project = 'P3890T')", con);
DataTable dt = new DataTable();
sda.Fill(dt);
{
this.Hide();
TRACK_10_PI T10 = new TRACK_10_PI();
T10.Show();
}
}
The new form TRACK_10_PI opens but always displays the data from the top row rather than as the WHERE clause has specified.
The reason I want the data retrieved from a database rather than simply hard coding it to the page is to accommodate possible changes to the information.
Thanks in advance
TRACK_10_PI?