PC Review


Reply
Thread Tools Rate Thread

Check Constraints AND ADO.NET

 
 
Polo
Guest
Posts: n/a
 
      23rd Nov 2005
Hi all,

I have a table where some columns have a constraint (datalength(Field1) > 0,
Field2 > 0)
When I use the Update method of the SqlDataAdapter to update the table, I
receive an error (a generic error)!
Why this error isn't generated in the RowUpdating event

Thank's in advance
Polo


 
Reply With Quote
 
 
 
 
Luxspes [MCP]
Guest
Posts: n/a
 
      24th Nov 2005
Polo wrote:
> Hi all,
>
> I have a table where some columns have a constraint (datalength(Field1) > 0,
> Field2 > 0)
> When I use the Update method of the SqlDataAdapter to update the table, I
> receive an error (a generic error)!

IMHO there is no such thing as a "generic error" in .NET, It would be
easier to help you if you copy&paste the exception message and
stacktrace in this forum.

> Why this error isn't generated in the RowUpdating event

The answer to that could be hidden in the characteristics of the
exception...

>
> Thank's in advance
> Polo
>
>

 
Reply With Quote
 
Polo
Guest
Posts: n/a
 
      24th Nov 2005
The error message (In French):

Une exception non gérée du type 'System.Data.SqlClient.SqlException' s'est
produite dans system.data.dll

Informations supplémentaires : Erreur système.

Polo

"Luxspes [MCP]" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> Polo wrote:
> > Hi all,
> >
> > I have a table where some columns have a constraint (datalength(Field1)

> 0,
> > Field2 > 0)
> > When I use the Update method of the SqlDataAdapter to update the table,

I
> > receive an error (a generic error)!

> IMHO there is no such thing as a "generic error" in .NET, It would be
> easier to help you if you copy&paste the exception message and
> stacktrace in this forum.
>
> > Why this error isn't generated in the RowUpdating event

> The answer to that could be hidden in the characteristics of the
> exception...
>
> >
> > Thank's in advance
> > Polo
> >
> >



 
Reply With Quote
 
Polo
Guest
Posts: n/a
 
      24th Nov 2005
The Message error :

Message "UPDATE statement conflicted with COLUMN CHECK constraint
'CK_Operator'. The conflict occurred in database 'PhotometricTechnicalData',
table 'Operator', column 'ID'." string

The problem is that this exception is generated by the update method.
Why this error doesn't appear in the rowUpdating event

Polo

"Polo" <(E-Mail Removed)> a écrit dans le message de
news:4385961d$0$12702$(E-Mail Removed)...
> The error message (In French):
>
> Une exception non gérée du type 'System.Data.SqlClient.SqlException' s'est
> produite dans system.data.dll
>
> Informations supplémentaires : Erreur système.
>
> Polo
>
> "Luxspes [MCP]" <(E-Mail Removed)> a écrit dans le message de
> news:(E-Mail Removed)...
> > Polo wrote:
> > > Hi all,
> > >
> > > I have a table where some columns have a constraint

(datalength(Field1)
> > 0,
> > > Field2 > 0)
> > > When I use the Update method of the SqlDataAdapter to update the

table,
> I
> > > receive an error (a generic error)!

> > IMHO there is no such thing as a "generic error" in .NET, It would be
> > easier to help you if you copy&paste the exception message and
> > stacktrace in this forum.
> >
> > > Why this error isn't generated in the RowUpdating event

> > The answer to that could be hidden in the characteristics of the
> > exception...
> >
> > >
> > > Thank's in advance
> > > Polo
> > >
> > >

>
>



 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      24th Nov 2005
Polo,

The most easy is to set the update in a try and catch block and than show
the exception in a message or in a commandline, whatever you want, than you
get much more information.

(This for testing purpose in real the catch has to be better)

I hope this helps,

Cor


 
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
smo and check constraints Dan Holmes Microsoft C# .NET 1 26th Oct 2007 10:18 AM
Re: Check constraints spanning multiple tables Michel Walsh Microsoft Access Queries 1 22nd Sep 2004 12:19 AM
Check constraints spanning multiple tables =?Utf-8?B?bWFya2Vib3k=?= Microsoft Access Queries 0 20th Sep 2004 10:35 PM
Check constraints Aaron Abdis Microsoft Access 12 14th Aug 2004 04:19 AM
Check constraints Aaron Abdis Microsoft Access Database Table Design 12 14th Aug 2004 04:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:48 PM.