Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Frank Cazabon
  Where is Frank Cazabon?
 
 Trinidad And Tobago
 Frank Cazabon
 To: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 Tags
Subject: RE: ODBC Connection to SQL Server
Thread ID: 416158 Message ID: 416195 # Views: 50 # Ratings: 0
Version: Visual FoxPro 8 Category: ODBC, ADO and OLEDB
Date: Tuesday, December 23, 2014 1:52:40 PM         
   


> > Hi,
> >
> > I have a weird one that's been bugging me for a couple days now and I cannot come up with a solution.
> >
> > Client has 6 PCs. 4 running Windows XP , 1 on Windows 7 and one on Windows 8.1.
> >
> > I have installed my VFP app on all and all are able to connect to a SQL Server database on a server except 1 XP PC.
> >
> > I can use the ODBC administrator to create a connection and test the connection successfully, but my application which uses a connection string and code like this:
> >
> > m.lnHandle = SQLSTRINGCONNECT(m.lcConnectionString,.T.) &&& 2nd parameter as .T., as the single-connection-per user, shared by remote views
> >
> > always sets m.lnHandle to a negative number.
> >
> > I have copied the file with the connection string from a working PC.
> >
> > I have created a very simple application which just tries to connect using the connection string and it fails too.
> >
> > Does anyone have any ideas? In over 100 installs similar to this I have never been able to use ODBC admin successfully and not my code.
> >
> > Frank.
> >
> > Frank Cazabon
> > Samaan Systems Ltd.
> > www.SamaanSystems.com
>
> Deja vu :-)
>

:)


> What is the result from that:
>
> m.lnHandle = SQLSTRINGCONNECT(m.lcConnectionString)
> IF m.lnHandle < 0
>    AERROR(laError)
>    MessageBox(laError[1,2])
> ENDIF
> 


That is part of the weirdness. I get a subscript out of range error, which is apparently due to the fact that laerror[1,2] does not exist.

A little later:

I copied vfp9.exe to the PC and started it running and created a program with just this code in and ran it. This time I got something a little more helpful:

I got a message (from memory so probably not accurate) that it could not connect due to too slow response from the server.

I closed that messagebox and then a prompt to login to the server was displayed!

I cancelled from there and ran the program again and it connected!

I added in some code to not display the login and it works fine from within VFP. However, I compiled this as an exe and when I run it from outside of VFP it fails with the message:

"Unable to complete login process due to delay in opening server connection."

Why would it work in VFP but not when using the runtime?

Frank.

Frank Cazabon
Samaan Systems Ltd.
www.SamaanSystems.com

ENTIRE THREAD

ODBC Connection to SQL Server Posted by Frank Cazabon @ 12/22/2014 8:27:36 PM
RE: ODBC Connection to SQL Server Posted by Borislav Borissov @ 12/22/2014 10:23:36 PM
RE: ODBC Connection to SQL Server Posted by Frank Cazabon @ 12/23/2014 1:52:40 PM
RE: ODBC Connection to SQL Server Posted by Frank Cazabon @ 12/23/2014 3:17:35 PM