Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 A very wee Problem

Author  Topic 

sqlboy
Starting Member

5 Posts

Posted - 2003-03-26 : 00:03:55
Hi there,

I have wee problem with the INSERT statement. The problem is very unusual. I would like yours help in the same. The problem is, files are running very well on my IIS but when i posted the same on net, it prompts me error messages. This is not an single case. Every database that has autoincrement(Identity) filed will show same error but works fine on my IIS .The error which it prompt is...

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Insert Error: Column name
or number of supplied values does not match table definition.

/minorities/postrec.asp, line 34

In brief, i would like to put some lights on the code and table. It's a very simple program in which user fill up their events details in the form and the vaules of that form is going to store in the table.The table contain one "AUTO-INCREMENT"(Identity) field which is increment by 1 every times a new records is added. I am using SQL 2000 and ASP.

The snapshot of Insert statement is :

strsql="insert into recruitment values('"& Request("title") & "','"&
Request("cname") & "' , '" _

& request("cdesc") &"' , '"& request("country") &"','"& request("state")
&"' , '"& request("ind") &"' , '" _

& request("indother") &"' , '"& request("level") &"','"& request
("jobdesig") &"' , '"& request("jobfun") &"', '" _

& request("jobdesc") &"' , '"& request("currency") &"','"& request
("lsalary") &"' , '"& request("hsalary") &"', '" _

& request("chkperks") &"' , '"& request("rdohousing") &"','"& request
("numvac") &"' , '"& request("degree") &"', '" _

& request("workexp") &"','"& request("add_info") &"','"& request("email")
&"', '"& request("sms") &"', '" _

& request("address1") &"', '"& request("address2") &"', '"& request
("pincode") &"','"& request("contry") &"', '" _

& request("constate") &"' , '"& request("city") &"','"& request("teloff")
&"','"& request("telhome") &"','"& request("postaddress") &"')"

set recordset = connection.execute(strsql)

I am very well aware what the error message means. But, both tables and files are same. One run fines on my IIS but other show the above mentions error.

In order to sort out the problem, i also specify explcitly all the variable names with INSERT command, i am getting the below mention error on my IIS as well as on the web. The error i am getting is :

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'recnum', table 'recruitment' ; column does not allow nulls. INSERT fails.

/minorities/postrec.asp, line 35

What am I doing wrong? I suspect that it might be related to the autoincrement(Identity) field. Or it might be that I just plain can't do this?

Thanks for your anticipations.
sqlboy


sqlboy

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-03-26 : 00:14:02
quote:

Hi there,

I have wee problem with the INSERT statement. The problem is very unusual. I would like yours help in the same. The problem is, files are running very well on my IIS but when i posted the same on net, it prompts me error messages. This is not an single case. Every database that has autoincrement(Identity) filed will show same error but works fine on my IIS .The error which it prompt is...

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Insert Error: Column name
or number of supplied values does not match table definition.

/minorities/postrec.asp, line 34

In brief, i would like to put some lights on the code and table. It's a very simple program in which user fill up their events details in the form and the vaules of that form is going to store in the table.The table contain one "AUTO-INCREMENT"(Identity) field which is increment by 1 every times a new records is added. I am using SQL 2000 and ASP.

The snapshot of Insert statement is :

strsql="insert into recruitment values('"& Request("title") & "','"&
Request("cname") & "' , '" _

& request("cdesc") &"' , '"& request("country") &"','"& request("state")
&"' , '"& request("ind") &"' , '" _

& request("indother") &"' , '"& request("level") &"','"& request
("jobdesig") &"' , '"& request("jobfun") &"', '" _

& request("jobdesc") &"' , '"& request("currency") &"','"& request
("lsalary") &"' , '"& request("hsalary") &"', '" _

& request("chkperks") &"' , '"& request("rdohousing") &"','"& request
("numvac") &"' , '"& request("degree") &"', '" _

& request("workexp") &"','"& request("add_info") &"','"& request("email")
&"', '"& request("sms") &"', '" _

& request("address1") &"', '"& request("address2") &"', '"& request
("pincode") &"','"& request("contry") &"', '" _

& request("constate") &"' , '"& request("city") &"','"& request("teloff")
&"','"& request("telhome") &"','"& request("postaddress") &"')"

set recordset = connection.execute(strsql)

I am very well aware what the error message means. But, both tables and files are same. One run fines on my IIS but other show the above mentions error.

In order to sort out the problem, i also specify explcitly all the variable names with INSERT command, i am getting the below mention error on my IIS as well as on the web. The error i am getting is :

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'recnum', table 'recruitment' ; column does not allow nulls. INSERT fails.

/minorities/postrec.asp, line 35

What am I doing wrong? I suspect that it might be related to the autoincrement(Identity) field. Or it might be that I just plain can't do this?

Thanks for your anticipations.
sqlboy


sqlboy



First check whether that table really has the identity seed.If u import the table you have to make the column as identity again.


Expect the UnExpected
Go to Top of Page

darinh
Yak Posting Veteran

58 Posts

Posted - 2003-03-26 : 00:16:15
If you have an identity column, you would need to explicitly define each column name so it doesn't try to insert anything into that column. It is good practice anyway.

If you explicitly define each column name then leave the identity column out.

Post both statements and script your table design and post it as well.

Go to Top of Page

sqlboy
Starting Member

5 Posts

Posted - 2003-03-26 : 02:46:18
quote:

If you have an identity column, you would need to explicitly define each column name so it doesn't try to insert anything into that column. It is good practice anyway.

If you explicitly define each column name then leave the identity column out.

Post both statements and script your table design and post it as well.





Hello darin,
As i said earlier, i allready tried the same things which you told me. In brief, for your clarification, when i did this thing

Insert into recruitment values(value2, value3,....). I got the error.
(field1 is identity) The error i am getting is...

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Insert Error: Column name or number of supplied values does not match table definition.

OR when i did this one,

Insert into recruitment (field2, field3,......)values(values 2,values3.....). I also got the error. The error this time i am getting is..

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'recnum', table 'recruitment' ; column does not allow nulls. INSERT fails.

But the delimma is, the former Insert statement working nicely on IIS and not on the web while latter Insert statement, showing error on both, IIS as well as web.

sqlboy

Edited by - sqlboy on 03/26/2003 05:33:54
Go to Top of Page

sqlboy
Starting Member

5 Posts

Posted - 2003-03-26 : 03:02:48
quote:

quote:

Hi there,

I have wee problem with the INSERT statement. The problem is very unusual. I would like yours help in the same. The problem is, files are running very well on my IIS but when i posted the same on net, it prompts me error messages. This is not an single case. Every database that has autoincrement(Identity) filed will show same error but works fine on my IIS .The error which it prompt is...

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Insert Error: Column name
or number of supplied values does not match table definition.

/minorities/postrec.asp, line 34

In brief, i would like to put some lights on the code and table. It's a very simple program in which user fill up their events details in the form and the vaules of that form is going to store in the table.The table contain one "AUTO-INCREMENT"(Identity) field which is increment by 1 every times a new records is added. I am using SQL 2000 and ASP.

The snapshot of Insert statement is :

strsql="insert into recruitment values('"& Request("title") & "','"&
Request("cname") & "' , '" _

& request("cdesc") &"' , '"& request("country") &"','"& request("state")
&"' , '"& request("ind") &"' , '" _

& request("indother") &"' , '"& request("level") &"','"& request
("jobdesig") &"' , '"& request("jobfun") &"', '" _

& request("jobdesc") &"' , '"& request("currency") &"','"& request
("lsalary") &"' , '"& request("hsalary") &"', '" _

& request("chkperks") &"' , '"& request("rdohousing") &"','"& request
("numvac") &"' , '"& request("degree") &"', '" _

& request("workexp") &"','"& request("add_info") &"','"& request("email")
&"', '"& request("sms") &"', '" _

& request("address1") &"', '"& request("address2") &"', '"& request
("pincode") &"','"& request("contry") &"', '" _

& request("constate") &"' , '"& request("city") &"','"& request("teloff")
&"','"& request("telhome") &"','"& request("postaddress") &"')"

set recordset = connection.execute(strsql)

I am very well aware what the error message means. But, both tables and files are same. One run fines on my IIS but other show the above mentions error.

In order to sort out the problem, i also specify explcitly all the variable names with INSERT command, i am getting the below mention error on my IIS as well as on the web. The error i am getting is :

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'recnum', table 'recruitment' ; column does not allow nulls. INSERT fails.

/minorities/postrec.asp, line 35

What am I doing wrong? I suspect that it might be related to the autoincrement(Identity) field. Or it might be that I just plain can't do this?

Thanks for your anticipations.
sqlboy


sqlboy



First check whether that table really has the identity seed.If u import the table you have to make the column as identity again.


Expect the UnExpected



Hi there,

Does you mean that i've to do explicitly something like this..

SET IDENTITY_INSERT <tblname> ON

for everytable which i posted on the remote server.

sqlboy

sqlboy
Go to Top of Page

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-03-26 : 05:41:33
quote:

quote:

quote:

Hi there,

I have wee problem with the INSERT statement. The problem is very unusual. I would like yours help in the same. The problem is, files are running very well on my IIS but when i posted the same on net, it prompts me error messages. This is not an single case. Every database that has autoincrement(Identity) filed will show same error but works fine on my IIS .The error which it prompt is...

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Insert Error: Column name
or number of supplied values does not match table definition.

/minorities/postrec.asp, line 34

In brief, i would like to put some lights on the code and table. It's a very simple program in which user fill up their events details in the form and the vaules of that form is going to store in the table.The table contain one "AUTO-INCREMENT"(Identity) field which is increment by 1 every times a new records is added. I am using SQL 2000 and ASP.

The snapshot of Insert statement is :

strsql="insert into recruitment values('"& Request("title") & "','"&
Request("cname") & "' , '" _

& request("cdesc") &"' , '"& request("country") &"','"& request("state")
&"' , '"& request("ind") &"' , '" _

& request("indother") &"' , '"& request("level") &"','"& request
("jobdesig") &"' , '"& request("jobfun") &"', '" _

& request("jobdesc") &"' , '"& request("currency") &"','"& request
("lsalary") &"' , '"& request("hsalary") &"', '" _

& request("chkperks") &"' , '"& request("rdohousing") &"','"& request
("numvac") &"' , '"& request("degree") &"', '" _

& request("workexp") &"','"& request("add_info") &"','"& request("email")
&"', '"& request("sms") &"', '" _

& request("address1") &"', '"& request("address2") &"', '"& request
("pincode") &"','"& request("contry") &"', '" _

& request("constate") &"' , '"& request("city") &"','"& request("teloff")
&"','"& request("telhome") &"','"& request("postaddress") &"')"

set recordset = connection.execute(strsql)

I am very well aware what the error message means. But, both tables and files are same. One run fines on my IIS but other show the above mentions error.

In order to sort out the problem, i also specify explcitly all the variable names with INSERT command, i am getting the below mention error on my IIS as well as on the web. The error i am getting is :

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'recnum', table 'recruitment' ; column does not allow nulls. INSERT fails.

/minorities/postrec.asp, line 35

What am I doing wrong? I suspect that it might be related to the autoincrement(Identity) field. Or it might be that I just plain can't do this?

Thanks for your anticipations.
sqlboy


sqlboy



First check whether that table really has the identity seed.If u import the table you have to make the column as identity again.


Expect the UnExpected



Hi there,

Does you mean that i've to do explicitly something like this..

SET IDENTITY_INSERT <tblname> ON

for everytable which i posted on the remote server.

sqlboy

sqlboy



It depends on How u POSTED the tables on the remote server.
If u have imported the tables you have explicitly set the identity.


Expect the UnExpected
Go to Top of Page

darinh
Yak Posting Veteran

58 Posts

Posted - 2003-03-26 : 16:53:30
quote:

Insert into recruitment values(value2, value3,....). I got the error.
(field1 is identity) The error i am getting is...

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Insert Error: Column name or number of supplied values does not match table definition.

OR when i did this one,

Insert into recruitment (field2, field3,......)values(values 2,values3.....). I also got the error. The error this time i am getting is..




What I meant is that without knowing the exact table design and exact sql statements no-one is going to be able to see what is wrong with your statement. If you posted the table design (script it in Enterprise Manager) and the exact statement where you explictly name each field then you will probably have more luck.

Go to Top of Page
   

- Advertisement -