Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapters
Message
 
À
17/04/2006 08:57:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01113780
Message ID:
01114036
Vues:
18
You use CursorSchema (UseCursorSchema = .t.), But you have SELECT * from ... as SelectCmd,
Are you sure that field order you get from that select match CursorSchema?
What happens if you change SelectCmd to:
this.SelectCmd = [SELECT CONTACTID, COMPANYNAME, CONTACTNAME, CONTACTTITLE, ADDRESS, CITY, REGION, ZIP,]+;
                         [COUNTRY, PHONE, FAX ]+;
                 [FROM CONTACTS WHERE zip = ?m.gcZip]
>>>I have read that a cursoradapter can use a parameterized SelectCmd, but when I have tried SelectCmd = "select * from contacts where zip = ?gcZip" I get the error "[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error". gcZip has the value "64124".
>>>
>>>Am I missing something?
>>>
>>>Thanks,
>>>
>>>Joe
>>
>>Joe,
>>Can you post whole class definition?
>
>Here's the class definition. Thanks
>
>**************************************************
>*-- Class: ca_contacts (c:\vfpapps\cursoradapter\ca.vcx)
>*-- ParentClass: cursoradapter
>*-- BaseClass: cursoradapter
>*-- Time Stamp: 04/17/06 07:46:02 AM
>*
>DEFINE CLASS ca_contacts AS cursoradapter
>
>
> Tag = ""
> Height = 22
> Width = 23
> SelectCmd = "select * from CONTACTS WHERE zip = gcZip"
> CursorSchema = "CONTACTID C(5), COMPANYNAME C(40), CONTACTNAME C(30), CONTACTTITLE C(30), ADDRESS C(60), CITY C(15), REGION C(15), ZIP C(10), COUNTRY C(15), PHONE C(24), FAX C(24)"
> Alias = "cursor1"
> DataSourceType = "Native"
> Flags = 0
> KeyFieldList = "CUSTOMERID"
> Tables = "CONTACTS"
> UpdatableFieldList = "CONTACTID , COMPANYNAME, CONTACTNAME, CONTACTTITLE, ADDRESS, CITY, REGION, ZIP, COUNTRY, PHONE, FAX"
> UpdateNameList = "CONTACTID CONTACTS.CONTACTID, COMPANYNAME CONTACTS.COMPANYNAME, CONTACTNAME CONTACTS.CONTACTNAME, " + ;
> "CONTACTTITLE CONTACTS.CONTACTTITLE, ADDRESS CONTACTS.ADDRESS, CITY CONTACTS.CITY, REGION CONTACTS.REGION, " + ;
> "ZIP CONTACTS.ZIP, COUNTRY CONTACTS.COUNTRY, PHONE CONTACTS.PHONE, FAX CONTACTS.FAX"
> UseCursorSchema = .T.
> Name = "ca_contacts"
>
>
> PROCEDURE AutoOpen
> *** Setup code: DO NOT REMOVE
> if not pemstatus(This, '__VFPSetup', 5)
> This.AddProperty('__VFPSetup', 1)
> This.Init()
> endif
> *** End of Setup code: DO NOT REMOVE
> ENDPROC
>
>
> PROCEDURE Init
> *** Setup code: DO NOT REMOVE
> local llReturn
> do case
> case not pemstatus(This, '__VFPSetup', 5)
> This.AddProperty('__VFPSetup', 0)
> case This.__VFPSetup = 1
> This.__VFPSetup = 2
> case This.__VFPSetup = 2
> This.__VFPSetup = 0
> return
> endcase
> set multilocks on
> llReturn = dodefault()
> *** End of Setup code: DO NOT REMOVE
> *** Select connection code: DO NOT REMOVE
> LOCAL loConnDataSource
> loConnDataSource = CREATEOBJECT('ADODB.Connection')
> ***
> loConnDataSource.ConnectionString = [Driver=SQL Server;Server=mySQlServer;Database=data;]
> ***

> loConnDataSource.OPEN()
> THIS.DATASOURCE = CREATEOBJECT('ADODB.RecordSet')
> THIS.DATASOURCE.CursorLocation = 3 && adUseClient
> THIS.DATASOURCE.LockType = 3 && adLockOptimistic
> THIS.DATASOURCE.ActiveConnection = loConnDataSource
> *** End of Setup code: DO NOT REMOVE
> *** Setup code: DO NOT REMOVE
> IF THIS.__VFPSetup = 1
> THIS.__VFPSetup = 2
> ENDIF
> RETURN llReturn
> ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: ca_contacts
>**************************************************
>
>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform