Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter and Dropdown Lookup
Message
De
27/07/2016 15:21:32
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows Server 2012 R2
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01638812
Message ID:
01638818
Vues:
36
Bingo - the SQL column is varchar( 254 ) so CASTing it as that works as expected. Thanks very much!

I suppose the lesson is that if VFP can't easily determine a column type then it will default to Memo.

>I would try to wrap expression into CAST(... AS char(50)) or something like that
>
>>I've got a dropdown lookup powered by a CursorAdapter class. In its current state it works fine but I need to make a minor appearance change. Current appearance is in the first image Cbo_CA_1.png.
>>
>>The underlying CursorAdapter is pulling data from SQL Server. Its .SelectCmd is currently
>>
>>"SELECT rft_type, rft_desc, rft_pk,rft_historical FROM dbo.ReferralType ORDER BY rft_type"
>>
>>The Combobox.RowSource is set in code to
>>
>>this.RowSource = this.zrtc_lookupalias + ".rft_type,rft_desc,rft_pk"
>>
>>All working fine so far. However, as shown in the first image, there is no visual separation between the rft_type and rft_desc columns in the combobox so it's a bit confusing to the user. For example, the top row says "Agriculture Range use" where "Agriculture" is the rft_type and "Range use" is the rft_desc. The desired enhancement is to add a separator " // " between rft_type and rft_desc when the latter is not blank or NULL. So in this case the first row should read "Agriculture // Range use".
>>
>>My first thought is to adjust the .SelectCmd as follows:
>>
>>"SELECT rft_type, CASE WHEN ISNULL( rft_desc, '' ) = '' THEN rft_desc ELSE ' // ' + rft_desc END AS rft_desc, rft_pk,rft_historical FROM dbo.ReferralType ORDER BY rft_type"
>>
>>Basically, if rft_Desc is not NULL or blank, prefix it with " // ". This query works as expected when run directly in SSMS. However, when built into the app, the combobox is showing "Memo" instead of the expected " // Range use" (see the second image Cbo_CA_2.png).
>>
>>I don't use CursorAdapters often and I'm not expert with them. As far as I can tell its .CursorSchema is neither defined nor used and there is no .DataSource defined.
>>
>>There is a framework in use, a modified version of VMP5. Thinking it might be an issue of the rft_desc field being wider than it was before, I tested with adding the prefix '' (empty string) so the length would not increase. However, the word "Memo" still appears.
>>
>>Am I missing something obvious with my .SelectCmd mods or cursoradapters in general, or does it look like this is something happening deep in the framework?
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform