public void DataRetrieval(DataGridView dataGridView)
{
connection.Open();
SqlDataAdapter da = new SqlDataAdapter("select ProductName,ProductBarcode,BuyingPrice,SalesPrice from Products", connection);
DataTable table = new DataTable();
da.Fill(table);
dataGridView.DataSource = table;
connection.Close();
}
public void DataSearch(TextBox textBox,DataGridView dataGridView)
{
connection.Open();
DataTable table = new DataTable();
SqlDataAdapter da = new SqlDataAdapter("select ProductName,ProductBarcode,BuyingPrice,SalesPrice from Products Where ProductName like'%" + textBox.Text + "%'", connection);
da.Fill(table);
dataGridView.DataSource = table;
connection.Close();
}
iki adet methodum var birincisi veritabanımdaki bilgileri datagridview a aktarıyor ikincisi ise textboxın textchanged özelline göre yapılan aramayı datagridview a aktarıyor bunu tek methodda yapabilir miyim?