Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing connection to SQL Server
Message
 
 
To
22/12/2022 10:49:38
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01685573
Message ID:
01685579
Views:
37
>>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?
>
>Without going into the issue what does an empty command do, how about just „select @@version“?

I like your suggestion. Because @@version should try to get the SQL Server version instead of an empty string.
As to the concern that this will fire too many times, my testing this SQLEXEC only happens if the user did not connect to the SQL Server for 5 or more seconds. (This was recommended by Walter Meester, as far as the time span).
I will change my code.
Thank you!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform