locked
sqlite concat string issue RRS feed

  • Question

  • User330912 posted

    I need to add string to Order Number. I added like this. But i am getting only order number without string. I tried it with || also its return 0.

    var data = conn.Query<Orders>("SELECT DateTime,('ORD-' + OrderId) AS OrderId, Total FROM Orders");

    Friday, January 10, 2020 4:49 PM

Answers

  • User330912 posted

    I Found it

    public string OrderNumber { get { return string.Format("{0} - {1} ", "ORD", OrderId); } }

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Saturday, January 11, 2020 9:05 AM

All replies

  • User2157 posted

    First thought, you appear to be using the alias OrderId which is also your column name, try removing the alias or using something unique and see if that helps

    Saturday, January 11, 2020 9:04 AM
  • User330912 posted

    I Found it

    public string OrderNumber { get { return string.Format("{0} - {1} ", "ORD", OrderId); } }

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Saturday, January 11, 2020 9:05 AM
  • User2157 posted

    That will also work!

    Saturday, January 11, 2020 11:57 AM