The best overloaded method match for 'int.TryParse(string, out int)' has some invalid arguments

I am trying to convert an interger to a string but keep getting this error message.  Can someone point out what I am missing.
string myStr;
                        string mySSN;
                        mySSN = patient.u.ssn;
                       
                        if (Int32.TryParse(mySSN, out myStr))
                        {
                            
                            patient.u.ssn = myStr;
                        }
                        else
                        {
                            // Failed! MyStr is not defined.
                        }

Open in new window

kwh3856Asked:
Who is Participating?
 
guru_samiCommented:
First thing:
The method is : Int32.TryParse Method (String, Int32)
but your parameter are mySSN  and myStr are both String.

Secondly when you say "I am trying to convert an interger to a string" not sure what you are trying to do...but you can convert an integer to String using ToString() method:

e.g. String mySSN = patient.u.ssn.ToString();
0
 
kwh3856Author Commented:
guru sami,
Thank you for your response.  What I realized is that I really needed to change the type of the field in the database to varchar which makes it a string also.  Therefore I do not need to covert the SSN anymore.  Again, thank you for your response.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.