New Posts New Posts RSS Feed: Unable to bind a grid.
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Unable to bind a grid.

 Post Reply Post Reply
Author
wyattda View Drop Down
Newbie
Newbie
Avatar

Joined: 10-Jul-2007
Location: United States
Posts: 2
Post Options Post Options   Quote wyattda Quote  Post ReplyReply Direct Link To This Post Topic: Unable to bind a grid.
    Posted: 10-Jul-2007 at 2:01pm
I am using the following code:

PersistenceManager manager = PersistenceManager.DefaultManager;

EntityQuery query = new EntityQuery(typeof(Customers), Customers.ActiveEntityColumn, EntityQueryOp.EQ, "True");

EntityList<Customers> customers = manager.GetEntities<Customers>(query);

dataGridViewMain.DataSource = customers;

When it gets to the EntityList<Customers> line of code it throws the following error: "An item with the same key has already been added.".

I have used DevForce before with no problems.  I think the main difference is the database that I am using.  I have no idea about the quality of the data in this database.  Could it be something to do with the data, or am I just using it incorrectly?

Please help..

Thanks,
Wyatt
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 10-Jul-2007 at 2:42pm
Wyatt,
 
I think that you are completely correct.  Bad data can certainly cause the problem that you are seeing, and I don't see anything wrong or suspicious in your code.
 
David 
Back to Top
wyattda View Drop Down
Newbie
Newbie
Avatar

Joined: 10-Jul-2007
Location: United States
Posts: 2
Post Options Post Options   Quote wyattda Quote  Post ReplyReply Direct Link To This Post Posted: 10-Jul-2007 at 2:46pm
I just noticed that even with a table that has only 2 records it still gives that error.  The table with the 2 records has good data.  So if the data appears to be ok then what else can it be?
Back to Top
naveen.menon View Drop Down
Newbie
Newbie
Avatar

Joined: 09-Jul-2007
Location: United States
Posts: 5
Post Options Post Options   Quote naveen.menon Quote  Post ReplyReply Direct Link To This Post Posted: 11-Jul-2007 at 1:04pm
Have you checked the OM to see if the the columns that have been set as keys do not have repetitive values in the database?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down