Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing Data Row column values and string values
Message
De
11/07/2013 08:52:10
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01578028
Message ID:
01578193
Vues:
61
>>>I don't think VFP code can easily be ported into C#, it's quite complex and uses macro substitution.
>>
>>Then make samples of input and output of different data types and values
>>
>>The usual much ado about nothing
>
>I posted the sample several times in this thread. That was sample of input. The output is simple: if I have empty string in the field as input and 0 in numerical column value, they should compare equal.
>
>Rob's solution was perfect and this piece of logic now works great. Unfortunately, a little farther in the logic I still get the famous Invalid cast exception. I started to look at it last night, hope to go to the bottom today.

You should't get to cast exceptions in the first place

(1) make samples of different types and different values in vfp, input and output

(2) Write a ToStringValue() method with overloads, one for each type
string ToStringValue( int value)
 
if( zero ) return ""
else
...

string ToStringValue( bool value)

string ToStringValue( datetime value)

string ToStringValue( decimal value)

etc
(3) You can now feed the value of the different columns to the ToStringValue() method and compare this value to the value in the Dictionary

It's as simple as that

I'm out of here
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform