Click here to Skip to main content
15,908,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Team,
I am getting following error.Kindly help
Error 24
operator '>' cannot be applied to operands of type 'string' and 'int'

string pincode = customerLoanRecord.Pincode > 0 ? customerLoanRecord.Pincode.ObjectToString() : "Null";

As in database i kept the datatype as string for Pincode as per requirement.

Thanks
Harshal
Posted

C#
string pincode=Convert.ToInt32(customerLoanRecord.Pincode) > 0 ? customerLoanRecord.Pincode.ToString() : string.Empty;


Check whether this works
 
Share this answer
 
Comments
[no name] 4-Feb-14 4:38am    
Thanks for your Reply .Thank you Brother .
its my sily mistake.
You need to convert customerLoanRecord.Pincode to integer before comparing it in the statement.
C#
string pincode = Convert.ToInt32(customerLoanRecord.Pincode) > 0 ? customerLoanRecord.Pincode.ObjectToString() : "Null";
 
Share this answer
 
Comments
[no name] 4-Feb-14 4:39am    
Thanks Buddy...
sily mistake i have done.
Thanks for your reply.
C#
string pincode =  Convert.ToInt16( customerLoanRecord.Pincode) > 0 ? customerLoanRecord.Pincode.ObjectToString() : "Null";
 
Share this answer
 
Comments
[no name] 4-Feb-14 4:48am    
Thanks Brother.
I am just waiting for u r reply.
Karthik_Mahalingam 4-Feb-14 4:50am    
welcome Harshal:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900