Solved

Int To String Error HELP!

Posted on 2006-10-19
4
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Accepted Solution

by:
CHAExchange earned 250 total points
ID: 17766471
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
ID: 17766474
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
ID: 17766615
You can try to use Convert.ToString(Request["S"]);

Regards,
Mishu
0
 

Author Comment

by:gtaro
ID: 17766708
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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