Jump to content

Recommended Posts

I am able to execute this command through MSSQL -  insert into LotPricing values(500,500,500)

 

but when I try to execute it through PHP I get the following error--

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> ADODB.Recordset<br/><b>Description:</b> Operation is not allowed when the object is closed.' in D:\hosting\member\croakingtoad\site1\test.php:47 Stack trace: #0 D:\hosting\member\croakingtoad\site1\test.php(47): variant->Close() #1 {main} thrown in D:\hosting\member\croakingtoad\site1\test.php on line 47

 

Here's the code I have--

//create an instance of the  ADO connection object
$conn = new COM ("ADODB.Connection")
  or die("Cannot start ADO");

//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$ovServer.";UID=".$ovUser.";PWD=".$ovPass.";DATABASE=".$ovDB;
  $conn->open($connStr); //Open the connection to the database

//declare the SQL statement that will query the database
$query = 'insert into LotPricing (PriceLow,PriceHigh,Description) VALUES (500,500,500)';

//execute the SQL statement and return records
$rs = $conn->execute($query);  /* Line 47 */

 

What am I doing wrong here?

 

The table has 4 columns-  PricingID, PriceLow, PriceHigh, Description

 

PricingID is a unique key with Identity turned on, i.d. start is 1 and i.d. seed is 1

 

 

Please help!  Thanks!

Link to comment
https://forums.phpfreaks.com/topic/104565-solved-insert-problem/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.