Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have an oData api url where I am trying to replace querystring values with dynamic values.
I wish to pass comma separated string to one of my placeholder but I am getting error:
"Input string is not in correct format".
Here, in my "$select" placeholder I am passing comma separated string but it's failing with above error.
Here is my code:
string test = string.Format("https://myapiUrl/views/my_view_name?$filter=customer_id eq {} & $select={}", "101", "price,createdOn");
Can anybody guide me on this ?
Thanks !!!
string test = string.Format("https://myapiUrl/views/my_view_name?$filter=customer_id eq {0} & $select={1}", "101", "price,createdOn");
Have to add the number of the index of the parameter to the curly braces. (zero based)
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
The testCards string picks up the value from web.config. But every time I try to use int.tryParse it gives a false value when I try to parse the string testCards. Any idea what I might be missing?
<add key ="TestCards" value ="4987654321098769,4111111111111111,4987654321098769"/>
string testCards = ConfigurationManager.AppSettings["TestCards"];
int flag=0
bool isSuceeded=false
isSuceeded = int.TryParse(testCards, out flag);
It's not an int! It has commas in it, and if it didn't have commas the number is much bigger than an int can hold in any .NET platform.
I'm gathering from the name TestCards that these are intended to be credit card numbers? In that case they should be strings.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
When posting data from view, I send it to the Controller via ajax and split the date time value, then the parameter becomes a string and I want to convert it to my datetime, but I encounter such an error
There is a blank/space at the end of your 'date' string. Use bgdate.Trim(). You may also check that bgdate is a non null string and have then a default value with something like (bgdate == null)?"01-01-1970":bgdate.Trim().
There's a white space in your value 08-04-2021 . You should Trim() it:
bgdate.Trim()
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I have a string path that starts with "file:///" and I am trying to remove it using string.Replace. Here is my code:
//This returns a string that starts with "file:///"
string missionPath = missionDataBase.FileLocationLocal;
missionPath = missionPath.Replace("file///","");
Whenever I check missionPath after the replace, the file:/// is still there - how do you appropriately handle forward slashes when removing them from a string?
You're missing a colon in your search string.
missionPath = missionPath.Replace("file:///","");
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I'm using LINQ to read in some XML and then use that to set properties in an object. The XML looks like this:
<display_location>
<full>London, United Kingdom</full>
<city>London</city>
<state/>
<state_name>United Kingdom</state_name>
<country>UK</country>
<country_iso3166>GB</country_iso3166>
<zip>00000</zip>
<magic>553</magic>
<wmo>03772</wmo>
<latitude>51.47999954</latitude>
<longitude>-0.44999999</longitude>
<elevation>24.00000000</elevation>
</display_location>
And the code I have is:
select new Forecast
{
//Set properties for the display location
DisplayLatitude = (double)i.Element("display_location").Element("latitude"),
DisplayLongtitude = (double)i.Element("display_location").Element("longtitude"),
DisplayElevation = (string)i.Element("display_location").Element("elevation"),
};
I can correctly set the latitude and elevation however I'm getting the exception "Value cannot be null" when I try to parse the longtitude.
I think it might be because of the negative symbol. How do I fix this?
It's "longitude", not "longtitude". Your string needs to exactly match the XML element name or you'll get a null value instead.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Well, I need to subtract the number from a string, and in the end she should continue being a string ...
I try:
PStruct.character[Index, PStruct.player[Index].SelectedChar].Y =
(Convert.ToInt32(PStruct.character[Index, PStruct.player[Index].SelectedChar].Y) - 1)
.ToString;
Character.Y is a string.
The error:
Cannot convert method group "ToString" to non-delegate type "string".
Anyone have tips or a solution?
Use parenthesis to invoke/call a method:
expr.ToString()
Without parenthesis it (ToString) is treated as a "method group", which is useful in some cases - but not here.
As written, you are trying to treat a function ToString as a type string.
As the comment mentioned, you probably meant to write ToString().