ON ct.custID = c.custID and(ct.custTranDate BETWEEN
I see there is no space between
and
and
bracket
.
Try:
OleDbDataAdapter da = new OleDbDataAdapter("SELECT ct.custID, c.custName, c.custAdd,ct.custTranDate,ct.custTranType,ct.custPaidAmt,ct.custDueAmt, c.custArea FROM custTransaction ct left JOIN custDetails c ON ct.custID = c.custID and (ct.custTranDate BETWEEN #2/28/13# AND #3/1/13# and ct.custID='CUST-000002')", con);
Further, use parameterized query to pass values. That way you can pass the values of date and id as per defined easily without creating any syntax error.
Further, you should put the search criteria as
WHERE
clause, like:
OleDbDataAdapter da = new OleDbDataAdapter("SELECT ct.custID, c.custName, c.custAdd,ct.custTranDate,ct.custTranType,ct.custPaidAmt,ct.custDueAmt, c.custArea FROM custTransaction ct left JOIN custDetails c ON ct.custID = c.custID WHERE ct.custID='CUST-000002' AND ct.custTranDate BETWEEN #2/28/13# AND #3/1/13#)", con);