Skip to Content.
Sympa Menu

freetds - Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in
  • Date: Wed, 18 Feb 2009 22:19:12 -0500

Ran September wrote:
> $conn=odbc_connect($db_host,$db_user,$db_pass);
> $sql="SELECT * FROM gages where company = '$custid' and gage_sn =
> '$sn'"; $rs=odbc_exec($conn,$sql);
...
> $sql1="SELECT * FROM mpc_web_users where user_name = '$userid'";
> $rs1=odbc_exec($conn,$sql1);
...
> on line 64 odbc_exec() didn't work and that's when the error occurred.
> i have many scripts like that, some worked and some aren't i really
> need a one time solution rather than re-programming my scripts.

http://www.freetds.org/faq.html#pending

This is what the FAQ means by "For one thing, they become better
programmers".

If your first query had an outer join to mpc_web_users, the second query
would be unnecessary. Your script would be simpler and run faster because
it would make only one call to the server.

Alternatively (but worse) the second query could use a separate
connection.

Both solutions work with all SQL database systems. The script as written
does not.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page