Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connect to SQL server
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01627022
Message ID:
01627097
Views:
57
>>This is the code that I run in my test program, the return value is -1. The connection strings I have tried are below. Both of these work on the server itself and also on the client machine that I installed sql server on. I have also tried a combination of both with ip addresses and they worked
>>Driver={SQL Server Native Client 10.0};Server=SERVERNAME\SQLEXPRESS; Database=KernelData;Trusted_Connection=yes;
>>Driver={SQL Server Native Client 10.0};Server=192.168.0.1\SQLEXPRESS; Database=KernelData;Uid=SQLUserName;Pwd=Password
>>
>>lnSqlHandler = SQLSTRINGCONNECT(constring)
>>
>>IF lnSqlHandler < 1
>>   MESSAGEBOX("Could not locate Sql Server Database ... Please contact Software Support_" + alltrim(str(lnSqlHandler)),48,'Kernel Software')
>>   close all
>>   RETURN
>>ELSE
>>	wait wind "SQL connection Success" time 0.2
>>ENDIF
>>~M
>
>This program doesn't tell us anything useful as why connection is failing. I did a quick search in our program and for the SqlStringConnect function and I don't see how to return SQL Server error back as to why connection is failing.

AERROR.
IF lnSqlHandler < 1
   AERROR(laError)
   MESSAGEBOX("Could not locate Sql Server Database ... Please contact Software Support" + CHR(13)+laError[1,2],48,'Kernel Software')
   close all
   RETURN
ELSE
  ..
ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform