Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to connect to a SQL Server database without using a
Message
 
To
19/06/2002 20:19:49
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00670389
Message ID:
00670392
Views:
37
This message has been marked as the solution to the initial question of the thread.
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
>Hi friends!
>
>I want to know how to connect to a SQL Server database without using a DSN. I mean, how to connect using a connection string. I don't know all the parameters needed to connect properly. This would be very helpful to me.
>
>TIA
>
>Renzo
>
>renzovela@yahoo.com
Hector Correa
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform