PC Review


Reply
Thread Tools Rate Thread

Re: ASP/ADO/VB.NET: How to update multiple datatables with typed datasets ?

 
 
Bauhaus
Guest
Posts: n/a
 
      11th May 2008
> Either change that settting in the database (not recommended) or make an
> edit that is allowed by the database.


The problem is I don't know how to edit it !
 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      11th May 2008
This isn't really a .NET issue, it's an access issue coupled with your
database design. I would suggest that you open Access and attempt an edit
manually and see if the database will allow it. Some edits won't be allow
due to the referential integrity and some will. We can't tell you which
will work and which won't, as it is something that is specific to your
database.

Once you know how to edit your tables manually, you can write .NET code to
do it programmatically.

-Scott

"Bauhaus" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>> Either change that settting in the database (not recommended) or make an
>> edit that is allowed by the database.

>
> The problem is I don't know how to edit it !



 
Reply With Quote
 
Bauhaus
Guest
Posts: n/a
 
      12th May 2008

"Scott M." <(E-Mail Removed)> schreef in bericht
news:eQ%(E-Mail Removed)...
> This isn't really a .NET issue, it's an access issue coupled with your
> database design. I would suggest that you open Access and attempt an edit
> manually and see if the database will allow it. Some edits won't be allow
> due to the referential integrity and some will. We can't tell you which
> will work and which won't, as it is something that is specific to your
> database.


In Access I added a new PizzaNr in Pizza without any problem. And I could
use this new PizzaNr in the other tables as well...
So it doesnt seem to be a referential integrity problem :s

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      12th May 2008
In your original message, you say you get the error when you attempt to
update or delete a record. Below you say everything is fine when you add
something. These are different operations.

Try updating or deleting a record in Access. The message you got is clearly
a referential integrity message, but adding a new item is not necessarially
going to break referential integrity.

-Scott


"Bauhaus" <(E-Mail Removed)> wrote in message
news:u$(E-Mail Removed)...
>
> "Scott M." <(E-Mail Removed)> schreef in bericht
> news:eQ%(E-Mail Removed)...
>> This isn't really a .NET issue, it's an access issue coupled with your
>> database design. I would suggest that you open Access and attempt an
>> edit manually and see if the database will allow it. Some edits won't be
>> allow due to the referential integrity and some will. We can't tell you
>> which will work and which won't, as it is something that is specific to
>> your database.

>
> In Access I added a new PizzaNr in Pizza without any problem. And I could
> use this new PizzaNr in the other tables as well...
> So it doesnt seem to be a referential integrity problem :s



 
Reply With Quote
 
Bauhaus
Guest
Posts: n/a
 
      12th May 2008
> Try updating or deleting a record in Access. The message you got is
> clearly a referential integrity message, but adding a new item is not
> necessarially going to break referential integrity.


Updated a record in Access: PizzaNr couldnt be changed since its a primairy
key in several tables, but Pizzaname wasnt a problem.
But I found the problem: in my update method, the sql statement also tried
to update PizzaNr, so I had to ommit it.

But now I got a new error: "Violation on concurrency: 0 of 1 records are
changed by the UpdateCommand." :s
Any suggestions what could be wrong ?

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      13th May 2008
Concurrency errors indicate that a change being attempted conflicts with the
reality of the data (i.e. two users editing simultaneously: one simply
updates a field, while the other person deltes the record and the delte is
committed before the update is).

-Scott

"Bauhaus" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>> Try updating or deleting a record in Access. The message you got is
>> clearly a referential integrity message, but adding a new item is not
>> necessarially going to break referential integrity.

>
> Updated a record in Access: PizzaNr couldnt be changed since its a
> primairy key in several tables, but Pizzaname wasnt a problem.
> But I found the problem: in my update method, the sql statement also tried
> to update PizzaNr, so I had to ommit it.
>
> But now I got a new error: "Violation on concurrency: 0 of 1 records are
> changed by the UpdateCommand." :s
> Any suggestions what could be wrong ?



 
Reply With Quote
 
Bauhaus
Guest
Posts: n/a
 
      14th May 2008

"Scott M." <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Concurrency errors indicate that a change being attempted conflicts with
> the reality of the data (i.e. two users editing simultaneously: one simply
> updates a field, while the other person deltes the record and the delte is
> committed before the update is).


Thanks for your replies.

I finally figured it out:

With the Access database, the field PizzaNr is not an autonumber. When I
tried the same database, but in sqlexpress, where I did give PizzaNr an
autonumber, I also got an error, but a different one: "Cant convert DBNull
to Integer".

So it had something to do with PizzaNr, since that was the only field of
type integer.
Then it suddenly hit me when I looked again at my gridview: in the gridview,
PizzaNr starts from 0...
So what happens is this: when the field is an autonumber, the
gridview/objectdatasource knows the field starts from 1. When the field isnt
an autonumber however, the field should start from 0 ...but in Access I gave
my first non-autonumber PizzaNr the value 1. Result: the code looks for a
PizzaNr with value 0 but doesnt find it so it throws an exception.

The reason I got the "Concurrency violation" was also because of this, 'cos
the code I wrote to detect multi-user conflicts also looks for a PizzaNr
with value 0...

So when I ommitted the code to detect multi-user conflicts AND changed
PizzaNr in my Access database to an autonumber, it worked fine.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP/ADO/VB.NET: How to update multiple datatables with typed datasets ? Bauhaus Microsoft ASP .NET 0 10th May 2008 06:55 PM
Combining and relating DataTables from different typed DataSets in =?Utf-8?B?TWFyYyBXb29sZnNvbg==?= Microsoft ADO .NET 1 4th Oct 2007 06:12 AM
Typed datasets with multiple datatables? =?Utf-8?B?RGF2ZQ==?= Microsoft ADO .NET 1 30th Apr 2007 06:36 PM
Inheriting Typed DataSets and DataTables =?Utf-8?B?UnlhbiBTaGF3?= Microsoft Dot NET Framework 4 20th May 2004 03:16 PM
Inheriting Typed DataSets and DataTables =?Utf-8?B?UnlhbiBTaGF3?= Microsoft VB .NET 1 20th May 2004 02:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:18 PM.