>Rather than going to each of my users’ machines, and building multiple ODBC DSN connections by hand for my Btrieve ODBC driver, I have been trying to use lnHandle = SQLConfigDataSource(0,1, "Pervasive Software ODBC-32", lcMySettings) as described in the Microsoft article Q142216.
>
>This returns a positive numeric value (success). In my next step though … SQLExec(lnHandle, lcMySQLCode, "MyCursor") gives me error 1466 – Connection handle is invalid.
>
>However; if I first create a remote view in the data environment of a different form, that uses one of my hand built ODBC data source names (I did build some), then I run the above code in it’s own separate form, it works! If I then close the connection with SQLDisconnect(lnHandle) and rerun lnHandle = SQLConfigDataSource(0,1, "Pervasive Software ODBC-32", lcMySettings) (which again returns a positive value) then I run SQLExec(lnHandle, lcMySQLCode, "MyCursor") it gives me the error 1466 error again.
>
>I’m missing some sort of concept here. Can anybody see the missing (or extra) step.
I've found the problem. I was assuming that SQLConfigDataSource() was returning a file handle. It wasn't. The command following SQLConfigDataSource() should have been SQLConnect(lcTheDSNNameThatIPassedToSQLConfigDataSource)
With SQLConnect() done, the following SQLExec() works fine now.
Bob
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement