Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQLOLEDB Vs SQLODBC
Message
De
30/03/2004 10:29:28
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
29/03/2004 22:12:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00890649
Message ID:
00890805
Vues:
26
>Help I am confused. I have read that OLEDB is supposed to be faster than ODBC so decided to try my hand at it.
>
>My code is:
>cStr = [Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=;Data Source=]
>ox=SQLSTRINGCONNECT(cstr)
>
>But every time I try this a window pops up "Select Data Source" and asks me to define a data source with the File Data Source and Machine Data Source Tabs.
>
>In ODBC I used this:
>
>cSql=[Driver={Sql Server};Server=;Database=;Int Security;]
>oConn=SQLStringConnect(cSql)
>
>This worked every time without popping up any window.
>
>Am I doing something wrong here or is OLEDB to be used only with ADO? Do I have to create this DataSource on every client that connects using OLEDB?
>
>Could someone please enlighten me as to how I can use OLEDB instead of ODBC while NOT using ADO, to get a connection to a SQL Server 2000 database?
>
>TIA
>
>Bernard

Bernard,
You're mixing OLEDB and ODBC.
OLEDB is to be used with ADO and ADO.NET.
SPT and RV in VFP use ODBC not OLEDB.
It's a misconception IMHO that OLEDB is faster than ODBC. There is no solid proof of that I know. Depending on what you're doing one might be faster than the other.
Neither with OLEDB nor ODBC you need to create a datasource on every client. There is connection string for both which you could use. ie:
* ODBC
lnHandle = SQLStringConnect("Driver=SQL server;"+;
  "Server=servername;Integrated Security=SSPI")
SQLExec(m.lnHandle,cStatement[,cCursorName])

* OLEDB - This is a very superficial sample
* Compared to (easier?) ODBC version
* there are many objects with different params you can use
oConnection = CreateObject("ADODB.Connection")
with oConnection
  .ConnectString = "Provider=SQL server;"+;
     "Server=ServerName;Integrated Security=SSPI" 
  .Open
  oRecordset = .Execute( cStatement )
endwith
CursorAdapters can use both and more :)
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform