retriving autonumber fields (MSAccess), datatable keys

P

pplppp

1.I made a typed dataSet using the VS.net xml editor, but it seems
that specifying the key using the xml editor to specify primary keys
does not work, since repeated calls to the Fill method of the
dataadapter would put duplicate rows into the datatable. so I had to
programatically add the keys to each table. just wondering if it's
some problem that other people faces or whether I missed some setting
in the xml editor.

2. I'm using MS Access as database and I have a table with an
autonumber field. I read an article on MSDN :
http://msdn.microsoft.com/library/d...cpconRetrievingIdentityOrAutonumberValues.asp
and used the OnRowUpdated event to retrieve the autonumber field, but
that means I would need to put null in the autonumber field of the
datatable when I call update. So I cannot specify that field as part
of a key since a key cannot take a null value. but then I would get
duplicate rows in the datatable that is not supposed to happen. I am
wondering if someone has a way to work around this

thx in advance.
 
M

Miha Markic

Hi,

pplppp said:
1.I made a typed dataSet using the VS.net xml editor, but it seems
that specifying the key using the xml editor to specify primary keys
does not work, since repeated calls to the Fill method of the
dataadapter would put duplicate rows into the datatable. so I had to
programatically add the keys to each table. just wondering if it's
some problem that other people faces or whether I missed some setting
in the xml editor.

You should configure dataadapter properly.
2. I'm using MS Access as database and I have a table with an
autonumber field. I read an article on MSDN :
http://msdn.microsoft.com/library/d...cpconRetrievingIdentityOrAutonumberValues.asp
and used the OnRowUpdated event to retrieve the autonumber field, but
that means I would need to put null in the autonumber field of the
datatable when I call update. So I cannot specify that field as part
of a key since a key cannot take a null value. but then I would get
duplicate rows in the datatable that is not supposed to happen. I am
wondering if someone has a way to work around this

You don't need to update autonumbered column, don't you?
 

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