Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using SQL Server Native Client 11.0 driver
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
01676553
Message ID:
01676577
Vues:
35
Well, color me impressed by the CursorAdapter. It works where as SPT does not.

Clearly, the property CursorSchema allows the developer to override VFP's guessing as to what kind of bucket (datatype) to create in the receiving cursor. Very nice!

The only problem I see is with SQL Server's Big Int datatype which will overflow VFP's 32 bit Integer datatype. Sure, you may never run into anything where a column value exceeds 2GB.
clear
set varcharmapping on
set asserts on
set multilocks on
driver1 = "SQL Server Native Client 11.0"
driver2 = "ODBC Driver 13 for SQL Server"
driver3 = "Sql Server"
driver4 = "ODBC Driver 17 for SQL Server"

connstr1 = "Driver={SQL Server Native Client 11.0};Server=.;Database=junk;Trusted_Connection=yes;"

local loCursor as CursorAdapter
loCursor = createobject('cursoradapter')
loCursor.Alias = 'catest'
locursor.DataSourceType ="ODBC"
locursor.DataSource = sqlstringconnect(connstr1)
locursor.SelectCmd = 'select * from odbc_test where biginteger = 7'
locursor.KeyFieldList = 'biginteger'
locursor.Tables = 'odbc_test'
locursor.UpdatableFieldList = 'biginteger, v_max'
locursor.UpdateNameList = 'biginteger odbc_test.biginteger, v_max odbc_test.v_max'
locursor.CursorSchema = 'biginteger i,date_1 d,datetime2_1 t,datetime_1 t,text_1 m,v_max m,v_900 m,v_800 m, c_10 c(10),v_50 v(50)'

if locursor.CursorFill(.t.)
	*browse
	*set step on
	replace v_max with 'being replaced and updated' in catest
	?'tableupdate result:',tableupdate(1)
else
	aerror(laErrors)
	messagebox(laErrors[2])
endif
>I will name the name you don't want to name. It was me that said that varchar(max) returns an empty string when using the SQL Native Client 11.0 driver.
>
>I might clarify that my results were from using Sql Pass Through (SPT) and not using the VFP CursorAdapter. I have never used the CursorAdapter, so you might be correct in that it works correctly with these relatively new SQL Server data types.
>
>When I worked at Microsoft and tested the VFP to SQL Server using ODBC and SPT and Remote Views there was no CursorAdapter nor were there SQL Server datatypes of varchar(max), date, datetime2, bigint, etc.
>
>Thanks for even considering that I was a guru - far from the fact!
>
>>Hi,
>>
>>First, I am using CursorAdapter to connect and update SQL Server tables.
>>
>>I looked through some old messages and find the gurus (I don't want to name names) warning of not being able to use SQL Server Native Client 11.0 driver. One message says that this driver, when using the type VARCHAR(MAX) will return empty string. However, just a few days ago I replaced the driver SQL Driver with the SQL Server Native Client 11.0 driver (for an in-house application that I use every day). And I don't see a problem, the SQL Server type VARCHAR(MAX) returns to the VFP 9 application the value in the field. The type DateTime is correctly mapped to the DATE type in VFP 9.
>>So, I have two questions:
>>1. What am I missing in being able to use SQL Server Native Client 11.0 driver without a problem?
>>2. I create connection string based on the driver value in XML configuration file. And I see that I replaced the old ODBC driver with the Native Client Driver. Just in case, I miss something, can the VFP 9 code determine what is in fact the SQL server being used?
>>
>>TIA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform