Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Insert into SQL Server issue
I am having problems inserting data into a simple table

Insert into Forums (Title, PageUrl, ContractId) Values ('54249',
'test01.asp',54249)
Microsoft OLE DB Provider for SQL Server error '80040e2f'

Cannot insert the value NULL into column 'ForumID', table
'LegalOnline.dbo.Forums'; column does not allow nulls. INSERT fails.

/sqllegal/submitcontract.asp, line 214

My table structure is below

ForumId Int 4 (identity column)

Title nvarchar 50

PageUrl nvarchar 250

contractid numeric 9(10,0)

if i copy and paste the above query in sql query analyzer and run it it
works perfectly but not through asp code.



can someone help



thanks





Report this thread to moderator Post Follow-up to this message
Old Post
JP SIngh
06-02-05 08:55 PM


Re: Insert into SQL Server issue
JP SIngh wrote:
> I am having problems inserting data into a simple table
>
> Insert into Forums (Title, PageUrl, ContractId) Values ('54249',
> 'test01.asp',54249)
> Microsoft OLE DB Provider for SQL Server error '80040e2f'
>
> Cannot insert the value NULL into column 'ForumID', table
> 'LegalOnline.dbo.Forums'; column does not allow nulls. INSERT fails.
>

The error message implies that the ForumID column is not an identity column.
Use Profiler to trace what is actually being executed on the SQL Server when
the error is generated..

> My table structure is below
>
> ForumId Int 4 (identity column)
>
> Title nvarchar 50
>
> PageUrl nvarchar 250
>
> contractid numeric 9(10,0)
>

This does not help. If Profiler does not provide your solution, in
Enterprise Manager, right-click your table and select All Tasks / Generate
SQL Script and show us the generated script.
We will also need to see the code used to run the INSERT.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Report this thread to moderator Post Follow-up to this message
Old Post
Bob Barrows [MVP]
06-02-05 08:55 PM


Re: Insert into SQL Server issue
It looks like ForumID is not an Identity Column

Try this then.
Insert into Forums (ForumID, Title, PageUrl, ContractId)
Values (1,'54249','test01.asp',54249)

Good Luck.!


"JP SIngh" <none@none.com> wrote in message
news:u2JChQ3ZFHA.1088@TK2MSFTNGP14.phx.gbl...
>I am having problems inserting data into a simple table
>
> Insert into Forums (Title, PageUrl, ContractId) Values ('54249',
> 'test01.asp',54249)
> Microsoft OLE DB Provider for SQL Server error '80040e2f'
>
> Cannot insert the value NULL into column 'ForumID', table
> 'LegalOnline.dbo.Forums'; column does not allow nulls. INSERT fails.
>
> /sqllegal/submitcontract.asp, line 214
>
> My table structure is below
>
> ForumId Int 4 (identity column)
>
> Title nvarchar 50
>
> PageUrl nvarchar 250
>
> contractid numeric 9(10,0)
>
> if i copy and paste the above query in sql query analyzer and run it it
> works perfectly but not through asp code.
>
>
>
> can someone help
>
>
>
> thanks
>
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Al
06-02-05 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:45 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.