Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to specify ODBC connection in EXE?
Message
From
16/10/1998 10:27:45
 
 
To
15/10/1998 10:12:10
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00146099
Message ID:
00147472
Views:
31
>Thanks, I'm getting much closer now but I'm still missing a few pieces of the puzzle.
>To summarize so far, to ship an EXE that uses remote views of SQL Server tables:
>
>In development environment, create a DBC. In the DBC, create a named connection using a DSN, then create remote views based on this connection. Code the app using these remote views.
>
>When the EXE is shipped to the field, before running the EXE, the end user must first set up a DSN either through the ODBC wizard or by running a VFP routine containing the code provided by Mr. Flores.
>
>When I tried the DSN approach in my development environment, I was unable to connect. Possibly two reasons: 1) I don't see how the DSN knows the name of the SQL server. 2) The connection was created using the driver "SQL Server (32 bit)" instead of plain "SQL Server". Does this matter?
>
>Assuming the DSN is working, for the next step, the app should prompt the user for the DSN, user id and password. A list of available DSNs can be generated from the code provided by Mr. Lucas. Here's where I'm confused again. Once you get this information from the user, how do you update the connection with it? I can browse the DBC and see the Property field in the Connection = 'ObjectType' record should get updated, but how? By directly writing the record or is there some other VFP command to do this?
>Thanks,
>-John

I think I misled you there a bit. You should try to use the same odbc driver in all your installations, this way when specifying the driver name it should always be the same (the name listed in the odbc administrator for sql server). To tell you the truth, the way I have it is as a method on a form that gets called upon pressing a combination of keys that are not documented and that only needs to be executed once. Here, you type in the server name as specified by the network administrator and the database name. Then a command button goes and creates the DSN on the fly. You should change this lines on the code I posted:

SuccFail = SQLConfigDataSource(0,1,"SQL Server",Settings)

Where "SQL Server" is the name of the odbc driver for SQL Server as it appears in the odbc administrator, and:

Do AddDSN With "My_Server_Name", "MyDSN", "MyDB"

HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform