sqlite concat string issue

AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭
edited January 10 in Xamarin.Forms

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");

Best Answer

  • AMNishanthiKumariAMNishanthiKumari US ✭✭✭
    edited January 11 Accepted Answer

    I Found it

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

Answers

  • AndyFlisherAndyFlisher GBBeta, University ✭✭✭

    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

  • AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭
    edited January 11 Accepted Answer

    I Found it

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

  • AndyFlisherAndyFlisher GBBeta, University ✭✭✭

    That will also work!

Sign In or Register to comment.