PAW.Btrieve oBtrieve = new PAW.Btrieve();
PAW.CustomerClass oCustomer = new PAW.CustomerClass();
int Status = oBtrieve.Connect("Z:\\payinc");
if (Status == 0)
{
GC.Collect();
Status = oCustomer.OpenFile();
if (Status == 0)
{
Status = oCustomer.GetFirst();
int cnt = oCustomer.RecordCount();
List<Customer> Custlist = new List<Customer>();
for (int i = 0; i < cnt; i++)
{
Custlist.Add(oCustomer);
oCustomer.GetNext();
}
GridView1.DataSource = Custlist;
GridView1.DataBind();
}
Status = oCustomer.CloseFile();
GC.Collect();
}
oBtrieve.Disconnect();
oBtrieve = null;
At the end of this block of code I have 28 copies of the last customer displayed in the datagrid and not the 28 diffrent customers i was wanting to see. Is there a way to just store the data from the oCustomer object and not a reffrence to the oCustomer object?