Solved

Int To String Error HELP!

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

778 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