Cell of type integer won't clear

  • Thread starter Thread starter steven_licciardinnoossppaamm
  • Start date Start date
S

steven_licciardinnoossppaamm

Hello,

I have a textbox which is bound to a field of type
integer. Everything works fine, the number displays and
can be updated etc.. However, when I delete the entry
the number just pops right back, i.e. the field refuses
to accept nothing.

When I go into SQL Enterprise manager and try and delete
the contents there I get a , "The value of the data type
you entered is not consistent with the data type or
length of the column" error. I do not get this error if
I do the same thing with vchar field. It seems that I
cannot reset the contents of the cell to DBNull, either
in code or in SQL Manager.

Any advice?

Thanks,

Steven
 
When I go into SQL Enterprise manager and try and delete
the contents there I get a , "The value of the data type
you entered is not consistent with the data type or
length of the column" error. I do not get this error if
I do the same thing with vchar field. It seems that I
cannot reset the contents of the cell to DBNull, either
in code or in SQL Manager.


First thing I'd check is make sure the column is really nullable. In
Enterprise Manager, if you go into "Design Table" there's a checkbox for
"Allow Nulls". If this is not checked, then that would cause behavior
you're seeing.
 
Yes, it's set to allow nulls, any other help would be
appreciated.

Steven
 
In said:
Yes, it's set to allow nulls, any other help would be
appreciated.

Sorry, it's always worth checking the simple stuff first, I figure.

Anyway, a couple more things to try, and otherwise hopefully someone
else might have some idea.

First, in Enterprise Manager, to set a numeric field to NULL, select the
field and then press ctrl-0 (zero). You won't see anything at first,
just move off the current row to see the NULL result. Deleting the
entry of a numeric field will always fail with the result you're seeing.

Also, try setting the field to null in query manager with a SQL query.
Those two things would let us know if the problem's in the database or
back in the code someplace.

Also, you might check to see if there's some constraint on the column
that's causing problems. Try

sp_helpconstraint Tablename

to see the contraints on the table.

Hope this helps a bit...
 
Ahhh, yes the ctrl-0 did the trick, I had been pressing ctrl-O (letter O all
this time, d'oh), which brings up the Open dialog. I have managed to fix it
in the code aswell by setting the value of the column at the specified row
to DBNull.Value i.e. row(rownum)(colname)=DBNull.Value.

Thanks for your help,

Steven
 
Back
Top