croakingtoad
05-07-2008, 11:34 AM
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!
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!
