ı created a project in c # and it loaded to data in access but searching button doesnt work every time find the last loaded please find the problem

baglan.Open();
            veri = new OleDbCommand("select urun,model,adet,boyut,aciklama from ogrenci where 'urun='" + urun + ";", baglan);
            oku = veri.ExecuteReader();

            while (oku.Read())
            {
                 comboBox1.Items.Add(oku["urun"].ToString());
                textBox1.Text = oku["model"].ToString();
                textBox2.Text = oku["adet"].ToString();
                comboBox1.Items.Add(oku["boyut"].ToString());
                textBox3.Text = oku["aciklama"].ToString();
               

            }


            oku.Close();
            baglan.Close();

Edited 5 Years Ago by __avd: Added [code] tags.

heres a sample. if you like to search in your databse i prefer to use "LIKE"... eg select * from tablenme where column_name LIKE "variable"..

CN = new SqlConnection(concString);
                
                String qry = "update BookMaster set Cat_code=" + int.Parse(Cat) + " Title='" + title + "' Publisher='" + Pub + "' No_Of_Pages=" + int.Parse(Page) + " No_Of_Cops=" + int.Parse(Copes) + " Date='" + dt.ToString() + "' price=" + int.Parse(Price) + " year_of_pub=" + int.Parse(Year) + " where Book_ID='" + GetBookId() + "'";
 
                SqlCommand com = new SqlCommand(qry, CN);
CN.Open();/// open cnnction string here
                int executed = com.ExecuteNonQuery();
This article has been dead for over six months. Start a new discussion instead.