This topic is locked

Inserting Nulls into KEY fields???

4/2/2005 1:24:25 AM
ASPRunnerPro General questions
Z
znetman author

Hello All,
I've got to be doing something wrong? To help resolve this issue I created a small test table with 2 fields. One is the ZORDER_ID which I'm use as the KEY field. Then I created a simple APSrunner App (took about 30 seconds, Nice) where I marked the ZORDER_ID field as the KEY. When I run the app and click in the Add button, then add TEXT into the ZORDER_ID and save, I get this error (shown below).
No matter what I enter into the ZORDER_ID it seems to want to add a Null into the table? I have even tried to set a defualt value in this feild and no go?
I tried different tables and building new apps? I'm current using version 3.1a.
Any ideas,

Thanks All,

Zack
** ERROR *****
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'ZORDER_ID', table 'XBASE01.dbo.ZTEMP01'; column does not allow nulls. INSERT fails.
/ASPRunnerPro/ZTEMP01_add.asp, line 141

Sergey Kornilov admin 4/3/2005

Zack,
I would recommend to make ZORDER_ID field an IDENTITY field. This way SQL Server will generate unique value for this field each time new record is added.

Z
znetman author 4/5/2005

Thanks, I see what you mean. I have converted my tables and it works OK.