Why am I getting an error when I use Inner join in C#? The query is working when I try it in Access.
try
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string query = "SELECT BookID, BookName, CategoryDescription, Language, AuthorName, YearPublished FROM tblCategory INNER JOIN (tblAuthor INNER JOIN tblBook ON tblAuthor.AuthorID = tblBook.AuthorID) ON tblCategory.CategoryID = tblBook.CategoryID";
command.CommandText = query;
OleDbDataAdapter da = new OleDbDataAdapter(command);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show("Error " + ex);
}

INNER JOINbetween brackets ok? It's not valid T-SQL at least. Have you tried if a very simple select, and then start adding stuff back to see where it fails?