J
Jean-Yves
Hi.
I have a weird problem when I update my database.
I am using SQL Server 2000. In my VB.NET application I used Web Services for
insert, update, delete.
I have a relation between 2 tables in my database.
I use dataset to transport data to and from the server.
I use native sqlclient provider.
I have .NET Framework 1.1
I use reflexion to create objects: SqlDataAdapter, SqlCommand. All this
using interfaces like IDBDataAdapter, IDBConnection etc ....
Let me explain the case a bit clearer.
** First test on Update in my VB.NET application
I retrieve a record from the database and I edit a foreign key field with a
value does not exist in the related table. Normally it should throw an
Exception, but as incredible as it is, it updates the database thus
violating the database constraint. I checked in my database and yes there it
is. Ok I go in Enterprise Manager and put back a correct value. Still from
Enterprise manager I tried again to put a wrong value in that field and
Enterprise Manager rejects the change. That was expected.
** Second test on the same database using a VB 6.0 application
From VB. 6.0 the same test fails and I get message Violation of Foreign key
.....
Ok that normal.
** Third test on INSERT in VB.NET application
If I try to insert a record with a wrong value in the foreign key field, I
do get an Exception this time.
It seems it's just when I do an UPDATE that it bypasses the database
constraint.
Whats the problem ? Is there a problem with the DataAdapter or the
SQLCommand ??
I am getting crazy with this.
Any help and clue most welcomed.
Jean-Yves
__________________________________________________________________ Jean-Yves
Mr ICQ#: 36608088 Current ICQ status: + More ways to contact me
__________________________________________________________________
I have a weird problem when I update my database.
I am using SQL Server 2000. In my VB.NET application I used Web Services for
insert, update, delete.
I have a relation between 2 tables in my database.
I use dataset to transport data to and from the server.
I use native sqlclient provider.
I have .NET Framework 1.1
I use reflexion to create objects: SqlDataAdapter, SqlCommand. All this
using interfaces like IDBDataAdapter, IDBConnection etc ....
Let me explain the case a bit clearer.
** First test on Update in my VB.NET application
I retrieve a record from the database and I edit a foreign key field with a
value does not exist in the related table. Normally it should throw an
Exception, but as incredible as it is, it updates the database thus
violating the database constraint. I checked in my database and yes there it
is. Ok I go in Enterprise Manager and put back a correct value. Still from
Enterprise manager I tried again to put a wrong value in that field and
Enterprise Manager rejects the change. That was expected.
** Second test on the same database using a VB 6.0 application
From VB. 6.0 the same test fails and I get message Violation of Foreign key
.....
Ok that normal.
** Third test on INSERT in VB.NET application
If I try to insert a record with a wrong value in the foreign key field, I
do get an Exception this time.
It seems it's just when I do an UPDATE that it bypasses the database
constraint.
Whats the problem ? Is there a problem with the DataAdapter or the
SQLCommand ??
I am getting crazy with this.
Any help and clue most welcomed.
Jean-Yves
__________________________________________________________________ Jean-Yves
Mr ICQ#: 36608088 Current ICQ status: + More ways to contact me
__________________________________________________________________