protected void UrunBul_Click(object sender, EventArgs e) { string urunAd = BulUrunAd.Text; SqlConnection baglanti = new SqlConnection(@"Data Source = (localdb)\MSSQLLocalDB; initial catalog = StokVeriTabani; integrated security = true;"); SqlCommand komut = new SqlCommand("SELECT * FROM StokListesi WHERE urunAdi LIKE \'%" + urunAd + "%\'", baglanti); baglanti.Open(); SqlDataReader reader = komut.ExecuteReader(); BulGrid.DataSource = reader; BulGrid.DataBind(); baglanti.Close(); }
protected void Page_Load(object sender, EventArgs e) { SqlConnection baglanti = new SqlConnection(@"Data Source = (localdb)\MSSQLLocalDB; initial catalog = StokVeriTabani; integrated security = true;"); SqlCommand komut = new SqlCommand("SELECT * FROM StokListesi", baglanti); baglanti.Open(); SqlDataReader reader = komut.ExecuteReader(); BulGrid.DataSource = reader; BulGrid.DataBind(); baglanti.Close(); komut.Dispose(); baglanti.Close(); }