private void frmAracListe_Load(object sender, EventArgs e)
        {
            cArac a = new cArac();

            a.AraclariGetir(lvAraclar);
            a.ModelleriGetir(cbAracModeli);
        }
コード例 #2
0
        public void ModelleriGetir(ComboBox liste)
        {
            SqlConnection conn = new SqlConnection(cGenel.connStr);
            SqlCommand    comm = new SqlCommand("Select ad from otobusModel where durum=1", conn);

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataReader dr;

            try
            {
                dr = comm.ExecuteReader();
                while (dr.Read())
                {
                    cArac a = new cArac();
                    a._modelAd = Convert.ToString(dr["ad"]);
                    liste.Items.Add(a);
                }
                dr.Close();
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
        }
        private void btnAracAra_Click(object sender, EventArgs e)
        {
            cArac a = new cArac();

            a.AraclarıGetirByTarih(txtTarih.Text, lvAraclar);
        }
        private void cbAracModeli_SelectedIndexChanged(object sender, EventArgs e)
        {
            cArac a = new cArac();

            a.AraclarıGetirByModel(cbAracModeli, lvAraclar);
        }