I want to get the data from my access database and show the data at Datagridview
. my tables are:
TABLE 1(AB) TABLE 2(CD) TABLE 3(EF) TABLE 4(GH)
------------- ----------------- ------------- -------------------
SID SName CID TID TID TName Tprice FID CID FCp FPID FID FCp Fprice
The query which I am using to retrieve the data in C# is:
OleDbCommand command1 = new OleDbCommand();
command1.Connection = connection;
command1.CommandText = "select T.TName, T.Tprice, P.FCp, P.Fprice from (([AB] S inner join [CD] T on S.TID = T.TID) (inner join [EF] C on S.CID = C.CID) inner join [GH] P on C.FID = P.FID where (S.SID = 2) ";
OleDbDataReader myreader = command1.ExecuteReader();
while (myreader.Read())
{
//DATA IS READ HERE
}
The error which I am getting is:
Syntax error at JOIN expression
I want TName, Tprice, FCp(TABLE 4), Fprice
as my output. Am I doing it right or is there any other way to do that.