I'm working on a simple contact database style program I am using button click event to start an event that pulls an adjacent text box text and queries it however i can't seem to figure out how to update the DGV. here is what i have.
private void searchButton_Click_1(object sender, EventArgs e)
{
string connString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\clients.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
SqlConnection conn = new SqlConnection(connString);
string searchQuery;
searchQuery = "select * from clients where [lastname] like'" + searchTB.Text + "%'";
try
{
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand(searchQuery, conn);
Want to update it here!
}
catch
{
MessageBox.Show("error" + e);
}
}
i have tried various snippets of code and i Am sure its a simple solution however i can't seem to find it