DataReader RRS feed

  • Question

  • User1979860870 posted


      I have below statement. I want if Status value is O then Open , else Closed,

     Department.Status = rdr["Status"].ToString();


    Wednesday, December 16, 2020 4:47 AM


  • User1312693872 posted

    Hi, jagjit saini

    Do you mean when rdr["Status"] is 'O', then Department.Status will be 'Open'? You can use the following:

    Department.Status = rdr["Status"].ToString() == "O"? "Open":"Closed";

    If what you talked about is the open or close of the DataReader, could you please show more code details?

    Best Regards,

    Jerry Cai

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 16, 2020 7:19 AM