0

I am building the Visual Foxpro 9 exe on my Windows 10 machine and using SQL Server 2019 for database. After building the exe, it is not opening and I am not getting any error in my event viewer.

My SQL Server 2019 connection string:

DRIVER=SQL Server;SERVER=tcp:<<DBServerHostName>>;UID=;Trusted_Connection=Yes;APP=<<App Name>>;;DATABASE=<<Database Name>>.

The exe is working fine if it is pointed to SQL Server 2008 database

The application should connect to SQL Server 2019 and should launch on Windows 10.

Stefan Wuebbe
  • 2,109
  • 5
  • 17
  • 28
Dhanaraj
  • 1
  • 1
  • 1
    Did you try the Debugger? Do you use the `AError`() function in your code if any of Vfp's `Sql*()` functions would indicate a failure?, e.g. by returning -1 – Stefan Wuebbe Nov 13 '22 at 17:03
  • 1
    See also [Microsoft ODBC Driver 17 for SQL Server](https://www.connectionstrings.com/microsoft-odbc-driver-17-for-sql-server/) – Stefan Wuebbe Nov 13 '22 at 17:14
  • It's working fine when I am running the application in development environment. However it's not working after building the exe on windows 10 – Dhanaraj Nov 13 '22 at 17:24
  • 1
    You can debug myproject.EXE files inside the IDE when you run them via `Do` command, and at run-time log all errors of course. Hence the `AError()` question in the previous comment – Stefan Wuebbe Nov 13 '22 at 17:31
  • @StefanWuebbe: I am not getting error while debugging the exe and it is working fine. However, the exe is not launched when we create the shortcut or try to double click the exe. FYI, I have cleared the FOXUSER.DBF file and placed in the config.fpw file project's root directory (which is same as the .pjx file location) – Dhanaraj Nov 14 '22 at 11:26
  • 1
    You are saying it doesn't work in exe only if the server is 2019. But you are also saying it is working in dev environment. Then it should be a setting different in both environments. I would temporarily put messageboxes just to see in exe to which point works and then exists. BTW change your connection to use Driver={SQL Server Native Client 11.0}. SQL server is a very old driver (2000). – Cetin Basoz Nov 14 '22 at 11:29
  • 1
    You said it works in exe if it is SQL 2008, right? If not, then might that be you don't have read events in code? – Cetin Basoz Nov 14 '22 at 11:31
  • Yes, It's working fine in SQL 2008 r2. If I need to enable read events, can you please let me know how to enable it? Because I am new to Foxpro – Dhanaraj Nov 14 '22 at 13:11
  • 1
    `Read Events` is a `Vfp` command, normally supposed to be located in the so-called "main.prg", typically a *.PRG code file which is set "as main" in the Vfp "Project Manager" – Stefan Wuebbe Nov 14 '22 at 17:41
  • 1
    "It is working fine in SQL 2008 r2". Is that a typo "in"? Did you mean "with"? If it is working with 2008 and not 2019 then it is something else not 'read events'. Anyway check your main prg code if it has "read events" in it. – Cetin Basoz Nov 14 '22 at 18:34
  • 1
    Did you in the meantime try what Cetin suggested?, see how far the code gets by adding lines like `MessageBox("First Line")` `MessageBox("Line 101")` and so forth temporarily to see that it is running and how far it gets before getting stuck. In real code you would rather log Infos, Warnings etc. e.g. by using the `StrToFile()` function – Stefan Wuebbe Nov 15 '22 at 07:43
  • Yes, it has Read Events in my Main.Prg file – Dhanaraj Nov 15 '22 at 13:01
  • 1
    It is not very helpful just saying "yes it has read events". Where does the connection occur? Did you ever try to include a messageBox just before the first connection (and one another just after it) to see if it is the problem at all. BTW, if you don't tag names using at sign then we don't see that you are replying unless explicitly come back here and check. ie: This would notify @StefanWuebbe. – Cetin Basoz Nov 15 '22 at 15:43
  • CetinBasoz, Stefan Wuebbe: Thank you for the great support. I found the problem after placing the logger. The database name is hard coded in the code, we replaced it with the new database server and the application starts to work. – Dhanaraj Nov 17 '22 at 12:50

0 Answers0