473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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


Jul 22 '05 #1
2 2099
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.
Jul 22 '05 #2
Al
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" <no**@none.com> wrote in message
news:u2**************@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

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: php newbie | last post by:
Hello, I am trying to load a simple tab-delimited data file to SQL Server. I created a format file to go with it, since the data file differs from the destination table in number of columns. ...
2
by: php newbie | last post by:
Hello, I have been trying to load a delimited data file to SQL Server. I have tried both of the options that are available: each time, I get different errors. This is on an eval version of SQL...
7
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the...
9
by: adi | last post by:
Hi all, Hope there is a quick fix for this: I am inserting data from one table to another on the same DB. The insert is pretty simple as in: insert into datatable(field1, field2, field3)...
5
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
29
by: pb648174 | last post by:
I have the following basic statements being executed: Create a temp table, #TempPaging Insert Into #TempPaging (Col1, Col2) Select Col1, Col2 From SomeOtherTable Order By Col2, Col1 Select...
8
by: nano2k | last post by:
Hi Shortly, I keep invoices in a table. Occasionally, someone will fire the execution of a stored procedure (SP) that performs several UPDATEs against (potentially) all invoices OLDER than a...
2
by: dublyner | last post by:
I am having an issue with linked servers on Windows 2000 running SQL 2005. I created the following test case to simplify an issue. I created a small procedure that selects the max site_no from a...
2
by: =?Utf-8?B?Y2F0?= | last post by:
We recently moved an older ASP.NET 1.1 code base on to ASP.NET 2.0, .NET 3.0 and Windows 2003 Server SP2. We started experiencing the following issue with the web cache (the code is straightforward...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.