public bool KurumDuzenle(Kurumlar k) { bool Sonuc = false; SqlCommand comm = new SqlCommand("Update Kurumlar set kurumAd =@kurumAd,iskonto=@iskonto where kurumID=@kurumID", conn); comm.Parameters.Add("@kurumAd", SqlDbType.VarChar).Value = k._kurumAd; comm.Parameters.Add("@kurumID", SqlDbType.Int).Value = k._kurumID; comm.Parameters.Add("@iskonto", SqlDbType.Int).Value = k._iskonto; if (conn.State == ConnectionState.Closed) { conn.Open(); } try { Sonuc = Convert.ToBoolean(comm.ExecuteNonQuery()); } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return(Sonuc); }
public void KurumTurleriGetir(ComboBox liste) { liste.Items.Clear(); SqlCommand comm = new SqlCommand("Select * from Kurumlar", conn); if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlDataReader dr = comm.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { Kurumlar k = new Kurumlar(); k._kurumID = Convert.ToInt32(dr["KurumID"]); k._kurumAd = dr["KurumAd"].ToString(); liste.Items.Add(k); } } dr.Close(); conn.Close(); }