Solved

sqlsrv generic errors

Posted on 2012-04-13
4
468 Views
Last Modified: 2012-04-18
i have recently started getting generic errors with the sqlsrv php mssql plugin.  i have been using it for a while now and have had no problems.  recently I moved my entire site/ databases to a new server, moss 2010, mssql 2008.  with the sqlsrv plugin you can access sql2008 from php.  i have always used the code

     $retval = runQuery($conn,$tsql);
		if(sizeof(sqlsrv_errors(SQLSRV_ERR_ERRORS),0)>0){
			$myErrors = json_encode(array("status"=>"Failed","step"=>"Update tools","errors"=>json_encode(sqlsrv_errors())));
			sqlsrv_rollback($conn);
			die($myErrors);
		}

Open in new window

to run the sql statment and check to see if there were any errors.  this used to return the actualy SQL error returned from MSSql 2008.  since we have moved to the new server i have been getting a generic error that makes no sense.

the error we have been getting is

SQLSTATE:IMSSP,
code:-14,
message:An invalid parameter was passed to sqlsrv_free_stmt.

I get this error from sqlsrv no matter the SQL error.  i am trying to see if the person adding the record will hit a Key contraint but i cannot tell what the error was with this.  i get this error wether i use sqlsrv_free_stmt or not. i get it even if i remove all instances of sqlsrv_free_stmt from my php code.

i have done alot of searching on this and can find many examples of "An invalid parameter was passed to " but the are always to other functions.  never to sqlsrv_free_stmt
0
Comment
Question by:talonsblade
  • 3
4 Comments
 
LVL 14

Expert Comment

by:Scott Madeira
ID: 37844206
What version of PHP, SQL server driver, etc.?
0
 

Author Comment

by:talonsblade
ID: 37844435
PHP 5.3.5

sqlsrv 2.0  just noticed that 3.0.1 was released on april9, need to check that out
0
 

Accepted Solution

by:
talonsblade earned 0 total points
ID: 37844622
figured out my problem, i was using a function to run my sqlsrv statments that didnt return any data, so i can quickly run update/insert statments.  this function was on another page and included a sqlsrv_free_stmt.  when i quit using my function and just called sqlsrv_query i got the correct error.  dont know why i have never had this error before.
0
 

Author Closing Comment

by:talonsblade
ID: 37859744
figured out the error myself and it was a stupid one
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
I have a large data set and a SSIS package. How can I load this file in multi threading?
The viewer will learn how to dynamically set the form action using jQuery.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question