Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating a recordset error Help!!

Status
Not open for further replies.

unicorn11

Programmer
Jun 10, 2000
392
IN
Product Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6001 <br>Product Name&nbsp;&nbsp;&nbsp;Peach Snappes 750ml <br>Rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;420 <br>Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>Image Path<br>Quantity&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;750ml <br>Product Type&nbsp;&nbsp;&nbsp;7 <br><br>What i am trying to insert<br>the sql i am using<br><b>Insert into product_mst values (6001,'Peach Snappes 750ml',420,'','',750,7); </b><br>the error it is giving<br><b><br>Microsoft OLE DB Provider for ODBC Drivers error '80040e14' <br><br>[Microsoft][ODBC SQL Server Driver][SQL Server]An explicit value for the identity column in table 'product_mst' can only be specified<br>when a column list is used and IDENTITY_INSERT is ON. <br><br>/rep/entered.asp, line 54 </b><br><br>What do i do so that i can solve that<br><br> <p>Unicorn11<br><a href=mailto:webmaster@tripmedia.com>webmaster@tripmedia.com</a><br><a href= > </a><br>Hi there it all likeminded fellows!!!!!!
 
This is because one of the fields is an identity fiedls and you are trying to set it explicity. The field in question is probably 'Product id'. The insert statement should not include the 'product id' as the value will be assigned by SQLServer ie. <br><br>Insert into product_mst values ('Peach Snappes 750ml',420,'','',750,7); <br><br>If the 'product id' must be 6001 and there is not another record with a product id of 6001 you can turn IDENTITY_INSERT on and use the original insert statement.<br>ie.<br><br>set IDENTITY_INSERT dbo.product_mst ON<br><br>Insert into product_mst values ('Peach Snappes 750ml',420,'','',750,7)<br><br>set IDENTITY_INSERT dbo.product_mst OFF<br>go<br><br>Hope this helps,<br><br>CD<br><br><br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top