A
Aahz
Hello;
I have dynamically crated string of numbers divided with comma
(2,3,5,6,4,)
Last comma is trimmed becose I need this string to create SQL query
When string is not empty it works fine, last comma is gone.
Now I need to make to determine if string is empty to skip trimming
comma.
Somehow I cannot do that becose when string is empty I always get:
"Object reference not set to an instance of an object."
Plese tell me what I am doing wrong ???
My code:
if (string =="")
{
newstring = "";
}
else
{
char comma = ',';
newstring = string.TrimEnd(comma);
}
Thanks;
I have dynamically crated string of numbers divided with comma
(2,3,5,6,4,)
Last comma is trimmed becose I need this string to create SQL query
When string is not empty it works fine, last comma is gone.
Now I need to make to determine if string is empty to skip trimming
comma.
Somehow I cannot do that becose when string is empty I always get:
"Object reference not set to an instance of an object."
Plese tell me what I am doing wrong ???
My code:
if (string =="")
{
newstring = "";
}
else
{
char comma = ',';
newstring = string.TrimEnd(comma);
}
Thanks;