Forum Moderators: open

Message Too Old, No Replies

New to ASP problems with SQL

Column does not allow null values

         

cherry

1:59 pm on May 21, 2003 (gmt 0)

10+ Year Member



I hope you can help. I get this error msg when trying to put info into a database. Will the error be in the ASP coding or my SQL table. Because I want all fields to be filled in on the database I made all my columns set to Not Null.

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'id', table 'trial.dbo.people_individual'; column does not allow nulls. INSERT fails.

I know this might be very simple but could somebody point me in the right direction......thank you so much.

csachin

3:56 pm on May 21, 2003 (gmt 0)

10+ Year Member



I think this is the problem in SQL. While creating the table 'trial.dbo.people_individual' for your application you must have unchecked the null option for field "ID". Change the option to allow nulls and the problem might be solved. Thats all I can think of.

WebJoe

4:01 pm on May 21, 2003 (gmt 0)

10+ Year Member



Cherry

Is seems as if you have a NOT NULL-constraint on the field 'ID' of your table 'trial.dbo.people_individual', which means you must give a value for that field when inserting data into that table (you pointed that one out yourself).

Make sure you have values for all fields! Your SQL-statemen t probably looks like


INSERT INTO trial.dbo.people_individual (field1, field2 etc) VALUES('sometext', 'moretext' etc)

OR

INSERT INTO trial.dbo.people_individual (id, field1, field2 etc) VALUES(NULL, 'sometext', 'moretext' etc)

while ist has to be

INSERT INTO trial.dbo.people_individual (id, field1, field2 etc) VALUES(1, 'sometext', 'moretext' etc)

cherry

8:15 am on May 22, 2003 (gmt 0)

10+ Year Member



Thanks guys

I got the problem sorted this morning.....when I made the table in SQL I didn't put the identity of the id column to 'Yes(Not for Replication)'.....this allows the id column to go up in value without you putting any information in the ASP code.

Just a simple thing but can drive you crazy.

So....still got lots to learn I know...

Thanks for your help :-)