Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter ADO Connection String
Message
From
25/06/2010 15:56:39
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01470497
Message ID:
01470614
Views:
52
>>>Hi,
>>>
>>>I am making some baby steps in learning to use CursorAdapter with DataSourceType 'ADO'. But I need to understand better a few things:
>>>
>>>1. This is the sample connection string (that works):
>>>
>>>.ConnectionString = 'Driver={SQL Server Native Client 10.0};Trusted_connection=Yes;Server=.;database=MYDatabase'	
>>>
>>>
>>>Does the period (.) after Server=. mean "default" server name? I have only one server on this PC so it works and this is why I assumed that this is what it means. I also tried to replace the period (.) with the name of the server and it works too.
>>>
>>>2. If I replace the 'SQL Server Native Client 10.0' with 'SQL Server Native Client' the connection still works. Is it better to always specify the version of the native client or leave it out and rely on the default setting?
>>>
>>>TIA.
>>
>>1) Dot means local (this computer). You may instead use computer name, (local), localhost but to my experience Dot works best. It is a ODBC connection string, not an ADO (OLEDB) connection string. ADO connection would look like:
>>
>>
.ConnectionString = 'Provider=SQLNCLI10;Trusted_Connection=yes;server=.;Database=MyDatabase'
>>
>>BTW it is not just the 10.0 that is different between driver names:
>>Sql Server - SQL 2000 ODBC
>>Sql Native Client - SQL 2005 ODBC
>>Sql Server Native Client 10.0 - SQL 2008 ODBC
>>
>>SQLOLEDB - SQL2000 OleDB
>>SQLNCLI - SQL2005 OleDB
>>SQLNCLI10 - SQL2008 OleDB
>>
>>2) 10.0 at the end of the ODBC driver or 10 at the end of OLEDB driver is NOT the version number but part of driver's name (it also matches with SQL server's version that it was released with but still it is not version number). You shouldn't leave that out. If you do, you would be using SQL 2005 driver not 2008. With an activex control if you leave the version number out (depending on registry) you get the latest version. It is not the case with SQL server driver.
>>
>>PS: Go to command window, type:
>>dx[spacebar][enter]
>>to invoke data explorer. There create a connection. OPen a code window and drag&drop a table from sql server on to that code window.
>>VFP creates an ADO based CursorAdapter for you (but the utility didn't take into account or didn't know schema you may need to edit scripts in SP1- or the code generating those scripts from options)
>>
>
>Cetin,
>
>Thank you very much for detailed and very helpful message. Do you mind telling (if does not take much of your time; otherwise I will just take it for granted) why specifying connection string as OLEDB (instead of ODBC), as you suggested, is better? Does it affect speed? Or it makes less confusing to what OLEDB drive you want to use?
>
>On your suggestion to try somthing with "dx", you mean Command Window in SSMS and not OS Command Window, right? Because if I type dx in the OS Command Window, nothing happens.
>
>Again, thanks for your help.

Specifying OLEDB is better because with VFP you would want to use ADO datasource when connecting to SQL server (if you use ODBC driver then VFP have bugs in interpreting new datatypes and you could lose data). Speed wise it may or may not be any better depending on what you are dong at a time (might be slower in general because it is a COM call). It is only much more reliable.

I meant VFP command window. dx is intellisense shortcut for:
DO HOME() + "DataExplorer.app"
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform