Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to connect to a SQL Server database without using a
Message
De
19/06/2002 20:33:17
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00670389
Message ID:
00670395
Vues:
30
Just in addition.
If you wish to ensure that your DSN connection string is with proper syntax, make a file DSN connection from ODBC Data Source Administrator.
After that locate the DSN file (the path normally is
"C:\Program Files\Common Files\ODBC\Data Sources\")
Open the DSN file as text (use notepad or whatever you want)
The connection string is bellow the [ODBC] section (replace new lines (CrLfs)with semi-columns (";"s))

>1. Define a DSN-less connection to your SQL Server database.
>Below is a sample to connecto to SQL Server's Northwind
>database.
>
>
>	OPEN DATA YourDBC
>	CREATE CONNECTION MyConnection ;
>	   CONNSTRING 'DRIVER=sql server;SERVER=(local);UID=sa;PWD=;DATABASE=northwind'
>	
>
>2. Create your remote view to use this connection.
>
>
>	CREATE SQL VIEW MyView REMOTE CONNECTION MyConnection SHARE AS ;
>	    select EmployeeID, LastName, FirstName from employees
>	
>
>3. Use your remote view as a regular VFP table.
>
>
>	OPEN DATA YourDBC
>	USE MyView
>	BROWSE
>	
>
>
>or, you could use SQL pass-through with something like:
>
>
>nConn = SQLStringConnect('DRIVER=sql server;SERVER=(local);UID=sa;PWD=;DATABASE=northwind')
>sqlexec(nConn, 'select * from employees', 'curEmployees')
>select curEmployees
>browse
>
>

HTH
Zlatin Zlatev,
MCSD (VS6)

Make solutions, not programs!

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform