Roland,
The following example connects to the northwind database and creates an SPT view for the customer table:
lcConnectionStr = "DRIVER={SQL Server};" +;
"SERVER=YourServerName"+";" +;
"DATABASE=northwind"+";" +;
"UID=sa"+";" +;
"PWD="
lnSql = SQLSTRINGCONNECT(lcConnectionStr)
SQLEXEC(lnSql, "SELECT * FROM Customers", "Customers")
SQLDISCONNECT(lnSql)
>Daniel,
>
>I don't know SQL, uh just a little.
>
>How would one create the necessary connection using the VFP commands to establish and disconnect from the SQL Server?
>
>Thanks in advance!
>Roland
>==============================================================================
>
>>Larry,
>>
>>I see what you mean concerning RVs, thanks.
>>
>>FWIW, I couldn't figure out a way to enter my selection criteria using VFP's view designer. However creating the view in code works great.
>>
>>>>Roland,
>>>>
>>>>I don't have a solution for remote views since I don't use them. In case you could use SQL passthrough, the following line should work:
>>>>
>>>>
>>>>SQLEXEC(lnSql, "SELECT whatever FROM MyTable WHERE DATEDIFF(day, BirthDate, getdate()) = 0")
>>>>
>>>>
>>>
>>>Interesting workaround. I use CONVERT() but this looks better. Thanks.
>>>
>>>>As Vlad mentioned, you need to use functions supported by SQL Server (T-SQL) when using SPT.
>>>>
>>>>This is different with remote views. I thought one of the advanteges of remote views was that you can define a view that works with different backends. Therefore I suspect above syntax won't work for RVs. Maybe an expert on remote views can chime in?
>>>>
>>>
>>>Remote views are just an elaborate means by MS to wrap the SPT functionality into a nice neat little ball. When you create a remote view, VFP actually translates that into SPT and sends it to the backend. So the same rules that govern what runs in SPT also apply to remote views.
Daniel