Solved

Int To String Error HELP!

Posted on 2006-10-19
4
257 Views
Last Modified: 2010-04-16
Guys when I am trying to complie this code I get an error that says "Cannot implicty convert type 'int' to 'string'.  The two highlighted things with this error message are the 0 where it says string subjectid= 0 and the word Policy where it says subjectId = policy.InsurancePolicy[0].SubjectId;
Please help need this code fixed ASAP, took over this c# project that I have no clue about..  I tried to do a Convert but it is not working for me.

string subjectId = 0;
  if (Request["S"] == null) {
    ARBilling.WebServiceProxies.InsurancePolicyInfo policy = (ARBilling.WebServiceProxies.InsurancePolicyInfo)this.DataSource;
      subjectId = policy.InsurancePolicy[0].SubjectId;
        } else {
      subjectId = Request["S"].ToString();
    }
0
Comment
Question by:gtaro
4 Comments
 
LVL 2

Accepted Solution

by:
CHAExchange earned 250 total points
Comment Utility
Try this. I put quotes around the 0 and added ToString() to subjectId = policy.InsurancePolicy[0].SubjectId

string subjectId = "0";
  if (Request["S"] == null) {
    ARBilling.WebServiceProxies.InsurancePolicyInfo policy = (ARBilling.WebServiceProxies.InsurancePolicyInfo)this.DataSource;
      subjectId = policy.InsurancePolicy[0].SubjectId.ToString();
        } else {
      subjectId = Request["S"].ToString();
    }
0
 
LVL 23

Assisted Solution

by:adathelad
adathelad earned 250 total points
Comment Utility
Hi,

Try:
string subjectId = "0";
  if (Request["S"] == null) {
    ARBilling.WebServiceProxies.InsurancePol<wbr/>icyInfo policy = (ARBilling.WebServiceProxies.InsurancePo<wbr/>licyInfo)t<wbr/>his.DataSo<wbr/>urce;
      subjectId = policy.InsurancePolicy[0].SubjectId.ToString();
        } else {
      subjectId = Request["S"].ToString();
    }
0
 
LVL 11

Expert Comment

by:Mihai Stancescu
Comment Utility
You can try to use Convert.ToString(Request["S"]);

Regards,
Mishu
0
 

Author Comment

by:gtaro
Comment Utility
Guys thanks to the both of you.  You posted the answer at the same time.  I am going to split the points.  Guys I have a quick project that I would need taken care of before 2pm PST today.  It is very simple but I do not have time to take care of it.  Basically it would be implementing this idea http://www.codeproject.com/aspnet/disableListItems.asp  I have a drop down on a web page and I want one of the options to not be selectable by the user.  There are 5 different options in the drop down that are pulled from a SQL table.  Basically one of those options can only be set if a record is imported so the user can not select this option.  If you are interested in working on this today and completing before 2pm PST please let me know. There will be a reward for this project, maybe money or a gift.  Please let me know ASAP guys if you are interested and the best way to reach you.  We can communicate throughout the day on Yahoo, AIM, or MSN

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now