Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing connection to SQL Server
Message
From
22/12/2022 10:51:32
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01685573
Message ID:
01685577
Views:
42
>>>Hi,
>>>
>>>Sorry for creating too many threads about somewhat of the same problem/solution.
>>>
>>>I have been thinking and analyzing my code, none stop, every waking hour. And I just realized why I am not seeing the results I expect.
>>>In a nutshell:
>>>The application method CONN_HANDLE_ACCESS fires to check if SQLEXE() works. The code is literally like this:
>>>
>>>IF SQLEXEC( oApp.conn_handle, "") < 0 
>>>
>>>But the above only tests if an empty string can be executed.
>>>
>>>Often times, after the above code, the program fails when attempting to SQL Select some records from the SQL Server.
>>>
>>>So, I am thinking that the code of testing SQLEXEC() against an empty string, should be changed to testing SQLEXEC() against something in the SQL Server. Because, if the connection to the SQL Server is broken, the SQLEXEC() can still successfully work on an empty string. Right?
>>>
>>>If the above logic is correct, how do I change the test of SQLEXEC() NOT against an empty string but against something in the SQL Server?
>>>
>>>Any suggestions or input? TIA
>>
>>Hi Dimitry!
>>
>>well we use the same to test the SQL Connection.
>>
>>See Message 01684874
>>of Thread https://www.levelextreme.com/Home/ViewPage?Activator=1021&ID=1684846
>>
>>Important: After a conn has lost, and you have to reconnect, you have to do some things i mentioned in the Message https://www.levelextreme.com/Home/ViewPage?Activator=1021&ID=1684883
>
>HI Jörg,
>
>So you are saying that executing SQLEXEC against an empty string is the same as executing a SQL Select again a table in the SQL Server?

Definitely Yes! for Microsoft SQL Server!

This is implemented in our SQL-Errorhandling which runs a thousand times a day...
Jörg Schneider
Joerg.Schneider@SMARTCRM.de
SMARTCRM CRM powered by MS Visual FoxPro
SMARTCRM GmbH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform