Could not determine which columns uniquely identify the rows for (a table)

E

Eric

I would receive this error message when using the DataAdapter Configuration
Wizard on certain tables. When looking at the table definition in MS SQL
Enterprise Mgr., the only common link I could find was that the column
defined as the PK was not listed first in the columns listed. Once I
modified the structure so the PK column was listed first, it worked fine.
Maybe this will help others having this problem.
 
W

William Ryan eMVP

Hi Eric:

Glad you posted this, it's always cool to post common gotchas to help people
avoid the same problem in the future. A few comments inline.

Eric said:
I would receive this error message when using the DataAdapter Configuration
Wizard on certain tables. When looking at the table definition in MS SQL
Enterprise Mgr., the only common link I could find was that the column
defined as the PK was not listed first in the columns listed.
-Were the PK fields listed at all? AFAIK, it shouldn't matter what position
the column appears in the query, it just needs to appear in there, otherwise
none of the code generators will be able create the update/delete/insert
logic. It can however create the selects no matter what. Another common
problem is if you use Joined tables or unions b/c the ide gets confused on
what to update.

Once I
modified the structure so the PK column was listed first, it worked fine.
Maybe this will help others having this problem.
I'm really curious about this.. if only one field of the key is listed,
it'll give you a problem too but are you saying that the field was in fact
included in the query, it's just the position where it appeared in the query
that made the difference?
--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
 
E

Eric

William,
I was happy to post this. I know others who have posted informational
messages have helped me out before and saved me a lot time. To your
questions, I know it sounds strange but what I did fixed the problem. In
this particular case I had three different tables that were failing in the
wizard. It would create the select and insert statements fine but not the
update and delete statements. In all three cases one column comprised the
primary key and they were correctly marked as such in Enterprise Mgr. In
two of the three tables the PK was listed second in the list of columns and
as the third column in the other table. The query I used in the wizard was;
select * from <table>. I think the only area of ado.net that was affected
by this was the data adapter wizard. If I manually created the
update/delete statments and necessary parameters everything worked fine.
Perhaps it was just a fluke albeit a strange coincidence.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top