OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\hotel_management.mdb;Persist Security Info=True;Jet OLEDB:Database Password=randhawa");
string query = "Select * from checkintable where cust_name = '" + txt_customerName.Text + "'";
OleDbDataAdapter da = new OleDbDataAdapter(query, con);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
dataGridView1.DataSource = ds.Tables[0];
}
else
{
MessageBox.Show("No such record found");
}