But works only with datagrid. Then how can I make it work after my search:
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Visa\App_Data\visa.mdb;Persist Security Info=False";
OleDbConnection sqlCon = new OleDbConnection(connectionString);
sqlCon.Open();
string commandString = "select * from bill where company='" + cbxMention2.Text + "'";
OleDbCommand sqlCmd = new OleDbCommand(commandString, sqlCon);
OleDbDataReader read = sqlCmd.ExecuteReader();
if (read.HasRows)
{
while (read.Read())
{
txtMention21.Text = read["code"].ToString();
}
}
else
{
MessageBox.Show("This code " + txtMention21.Text + " doesnt exist");
}
read.Close();
sqlCon.Close();