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 .
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");
}
here is the brandcol code .
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 );
}
}
}