0

I thought i already assigned it?

string srch1 = "";
            string srch2 = "";

            if (cb1.SelectedItem.ToString() == "Book Title")
            {
                srch1 = "Book_Title";
            }
            else if (cb1.SelectedItem.ToString() == "Call Number")
            {
                srch1 = "Call_Number";
            }
            else if (cb1.SelectedItem.ToString() == "Accession_Number")
            {
                srch1 = "Accession_Number";
            }


            if (cb2.SelectedItem.ToString() == "Ascending Order")
            {
                srch2 = "ASC";
            }
            else
            {
                srch2 = "DESC";
            }

As you can see, I already assigned it. So why the error?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by pakunoda
0

You've misinterpreted the error, which is actually a warning, not an error.

You've assigned the data to your variable, but you don't use that variable anywhere in your code to get the data back out of it.

So even though you have for example: srch2 = "DESC"; you don't use that value anywhere.

Edited by Ketsuekiame: n/a

0

I see. There's another error but it's not related with this. I understand this now.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.