croakingtoad Posted May 7, 2008 Share Posted May 7, 2008 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! Quote Link to comment https://forums.phpfreaks.com/topic/104565-solved-insert-problem/ Share on other sites More sharing options...
croakingtoad Posted May 9, 2008 Author Share Posted May 9, 2008 never mind...changed the way i was doing it. Quote Link to comment https://forums.phpfreaks.com/topic/104565-solved-insert-problem/#findComment-537007 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.