Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Insert into SQL Server issue

Reply
Thread Tools

Insert into SQL Server issue

 
 
JP SIngh
Guest
Posts: n/a
 
      06-02-2005
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




 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-02-2005
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.


 
Reply With Quote
 
 
 
 
Al
Guest
Posts: n/a
 
      06-02-2005
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" <> wrote in message
news:...
>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
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
base64 decode then insert into SQL Server robert.bull@charter.net ASP General 5 03-15-2006 08:26 PM
Storing binary into SQL Server in INSERT string Kevin Lawrence ASP .Net 0 02-03-2006 10:15 AM
Tools to extract data from SQL database and convert it into XML & insert XML data into SQL databases Harry Zoroc XML 1 07-12-2004 10:10 PM
How to read an SQL Server into a ASP page and then change, add, delete and write it back to SQL Server Belinda ASP General 4 06-11-2004 12:16 PM
Err when insert into microsoft sql server 2000 Mike John ASP .Net 1 11-14-2003 11:25 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57