0

I have the following code:

string sSelect = @"select a.nume, a.cui, b.suma, b.perioada, c.nume_produs from client as a
                   left join client_produs as b on a.id_client = b.id_client
                   left join produs as c on b.id_produs = c.id_produs";
con.Open();
OleDbCommand cSelect = new OleDbCommand(sSelect, con);
OleDbDataReader clientsInfo = cSelect.ExecuteReader();

The purpose of the above select statement is to retrieve all the information stored in the database.

The problem is I am getting an error : "System.Data.OleDb.OleDbException: 'Syntax error (missing operator) in query expression 'a.id_client = b.id_client left join produs as c on b.id_produs = c.id_produs'.'"

I cannot find the reason why and any help would be appreciated.

4
  • Do you get the same error if you put the entire string that defines sSelect on a single line? Commented Jan 5, 2021 at 16:35
  • What database? OLEDB is the driver API, not a specific database. Commented Jan 5, 2021 at 16:36
  • @Russ, I managed to solve it by putting parantheses aroung the first join. Commented Jan 5, 2021 at 16:43
  • Which RDBMS? @Russ the @ symbol means a multiline string Commented Jan 5, 2021 at 16:49

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.