Error Connecting to SQL Server 2008

QuestionsError Connecting to SQL Server 2008
Stan asked 11 years ago

In trying to connect to a MS SQL Server 2008 database, I am not able to connect using either one of the three options to connect from the loading demo. I keep receiving a invalid parameter was passed error.

: IMSSP Error Code: -14 Message: An invalid parameter was passed to sqlsrv_query. – select top (1+0)

13 Answers
Abu Ghufran answered 11 years ago

Hello Stanley,

This is very unique.
Can you send me the SQL query / grid file with sample table dump, so that i can regerate the case.

Regards,

Stan answered 11 years ago

I have replied to the email with the appropriate files.

Abu Ghufran answered 11 years ago

Case resolved on chat, and issue was in database configuration, which resolved afterwards.

Mike answered 11 years ago

I have an email in to Abu, but I am getting the same message. Can the fix be posted here?

stan answered 11 years ago

This was the array that i used for connecting:

$db_conf = array();
$db_conf["type"] = "mssqlnative"; // or mssql
$db_conf["server"] = "10.0.1.205"; // ip:port
$db_conf["user"] = "username";
$db_conf["password"] = "password";
$db_conf["database"] = "databasename";

Stan answered 11 years ago

And also that if your server name is "ipaddress.ip.ip/testing"

It does not work. It has to be an absoilute domain or IP

I hope this is helpful

Stan answered 11 years ago

ALSO:

If setting a databsase table for CRUD operations, I had to use the schema:

$g->table = "[database].[dbo].[tablename]";

But subqueries are still:

$g->select_command = "SELECT * from table name";

bnyhamin answered 11 years ago

Abu Ghufran, what did do you do to resolved this problem?

Abu Ghufran answered 11 years ago

Stan made some configuration changes on his side, after which it went smooth.
He also replied on this thread, please review.

PS: It is not supported in free version

Joost answered 10 years ago

I just bought the developer version and I am usering SQL Server 2012.

I have also tried all examples from the loading demo but still get the error:

Couldn't execute query. SQLState: IMSSP Error Code: -14 Message: An invalid parameter was passed to sqlsrv_query. – select top (1+0) * FROM [dbname].[dbo].[Accounts] WHERE 1=1

I am using config similair to Stan's:
$db_conf = array();
$db_conf["type"] = "mssqlnative"; // or mssql
$db_conf["server"] = "127.0.0.1"; // ip:port
$db_conf["user"] = "user";
$db_conf["password"] = "pw";
$db_conf["database"] = "dbname";

Regards

Abu Ghufran answered 10 years ago

Pasting Mike's reply to help others: Got it working, it was the account that IIS is using for Anonymous Authentication. Co worker that setup the new SQL box was unaware that I had a user that needed DB rights

joost answered 10 years ago

Finally got it working. My sqlserver settings were not correct. I have used the command tool sqlcmd to test this. The previously mentioned settings were the right one.

And thanks Abu, for guiding me to the right direction!!

mike answered 10 years ago

Joost or Stan, my config section looks the same as you show. Are there changes I need on the SQL server itself?

Your Answer

2 + 2 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?