예제 #1
0
        private void ArayuzDoldur()
        {
            _baglanti.ac();
            DataTable dtIl = new DataTable();

            //new SqlDataAdapter(("Select * from dbo.ilTanimlari Order By ilAdi"), _baglanti.cnn).Fill(dtIl);
            new OleDbDataAdapter(("Select * from ilTanimlari Order By ilAdi"), _baglanti.oleConn).Fill(dtIl);
            comboBoxIl.DisplayMember = "ilAdi";
            comboBoxIl.ValueMember   = "ilPlaka";
            comboBoxIl.DataSource    = dtIl;

            _baglanti.kapat();
        }
예제 #2
0
        private void MusteriAra(bool ad, bool tum)
        {
            _baglanti.ac();
            DataTable dtMst = new DataTable();

            if (tum)
            {
                //new SqlDataAdapter(string.Format(("Select * from dbo.musteri Order By mstAd ")), _baglanti.cnn).Fill(dtMst);
                new OleDbDataAdapter(string.Format(("Select * from musteri Order By mstAd ")), _baglanti.oleConn).Fill(dtMst);
            }
            else
            {
                //new SqlDataAdapter(string.Format(("Select * from dbo.musteri Where {0} like '" + tsCariAra.Text + "%' Order By mstAd "), ad == true ? "mstAd" : "mstVN"), _baglanti.cnn).Fill(dtMst);
                new OleDbDataAdapter(string.Format(("Select * from musteri Where {0} like '" + tsCariAra.Text + "%' Order By mstAd "), ad == true ? "mstAd" : "mstVN"), _baglanti.oleConn).Fill(dtMst);
            }

            dgwMusteriCari.DataSource = null;
            dgwMusteriCari.Rows.Clear();

            if (dtMst.Rows.Count == 0)
            {
                return;
            }

            dgwMusteriCari.Rows.Add(dtMst.Rows.Count);
            int i = new int();

            foreach (DataRow dr in dtMst.Rows)
            {
                dgwMusteriCari.Rows[i].Cells["mstId"].Value  = dr["mstID"];
                dgwMusteriCari.Rows[i].Cells["mstKod"].Value = dr["mstKod"];
                dgwMusteriCari.Rows[i].Cells["mstAd"].Value  = dr["mstAd"];
                i++;
            }

            dgwMusteriCari.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
            dgwMusteriCari.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            _baglanti.kapat();
        }