first i simple want to fill all the brand table record in the dataset .after that i want to fill all the dataset data
into the _brandColl collection .here is the brandcol code .Code:private void Form1_Load(object sender, EventArgs e) { string strConn = Properties.Settings.Default.Path + "\\" + Properties.Settings.Default.DatabaseName; using (OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strConn)) { conn.Open(); OleDbCommand cmd = new OleDbCommand("Select * from Brand"); }Code:class BrandCol { // Declare a field to hold a dictionary of BrandCls objects keyed by the Brandid property (an integer) private Dictionary<int, BrandCls> _brandColl; // Constructor: instantiate an instance of the dictionary public BrandCol() { _brandColl = new Dictionary<int, BrandCls>(); } public void AddBrand(BrandCls brandClass) { int key = brandClass.Brandid; if (_brandColl.ContainsKey(key)) { _brandColl.Add(key,brandClass ); } } }




Reply With Quote