Solved

Int To String Error HELP!

Posted on 2006-10-19
4
262 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

Industry Leaders: 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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

740 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