473,666 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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',54 249)
Microsoft OLE DB Provider for SQL Server error '80040e2f'

Cannot insert the value NULL into column 'ForumID', table
'LegalOnline.db o.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 2110
JP SIngh wrote:
I am having problems inserting data into a simple table

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

Cannot insert the value NULL into column 'ForumID', table
'LegalOnline.db o.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','tes t01.asp',54249)

Good Luck.!
"JP SIngh" <no**@none.co m> wrote in message
news:u2******** ******@TK2MSFTN GP14.phx.gbl...
I am having problems inserting data into a simple table

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

Cannot insert the value NULL into column 'ForumID', table
'LegalOnline.db o.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
16500
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. When I execute the query, I get an error saying that only sysadmin or bulkadmin roles are allowed to use the BULK INSERT statement. So, I proceeded with the Enterprise Manager to grant myself those roles. However, I could not find sysadmin or...
2
10853
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 Server 2K, with SP 3a on a Windows XP box. First, I tried to load the data with Bulk Insert. This didn't go through as it requires sysadmin/bulkadmin privileges. I am the only person using the SQL Server, and I wanted to grant myself those
7
12119
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 servers using sp_addlinkedserver on both database servers. When I call the Commit API of oledb I get the following error: Error state: 1, Severity: 19, Server: TST-PROC22, Line#: 1, msg:
9
4232
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) select a1, a2, a3 from temptable...
5
3239
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 I use an argument to difference between an 'edit' vs. and 'add. But since I have field validation on both 'footer' and 'edit' columns I can't submit my edits since the footer validation kicks in.If I take the validation off then the both work fine...
20
5619
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 client-side HTML, CSS, etc. What I want to do is somehow insert a *server control* into the , then set the server control's properties at runtime.
29
27577
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 * from #TempPaging I can't provide a reproduceable scenario right now without making this
8
3509
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 date that is supplied to the SP as a parameter. The SP is usually a lengthy process (it takes at least 30 mins). The problem is that SQL server 2000 Dev Edition doesn't allow me to insert new invoices that are "younger", while the SP is executing....
2
1918
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 table called site on one server and called it from another. It runs fine. However when I try to insert it into a table ( # or permanent ) using insert-exec it never comes back. I ran a profiler and I was not even able to trap the call, so I...
2
2852
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 and worked flawlessy before the upgrade): Dim o As Object = Cache.Get(key) If o Is Nothing Then Cache.Insert(key, GetTheData()) o = Cache.Get(key) End If
0
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8352
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.