I have three tables course, texts and book_adoption. I am getting an error when i am executing the following code-
connect();
string qstr = "select course_id, book_isbn, book_title from texts natural join Book_Adoption natural join course where exists(select count(book_isbn) from Book_Adoption natural join course group by dept having count(course_id)>1) order by book_title";
da = new OleDbDataAdapter(qstr, con);
ds = new DataSet();
da.Fill(ds, "course");
//da.Fill(ds, "Texts");
//da.Fill(ds, "Book_Adoption");
dt = ds.Tables[0];
for (int i = 0; i < dt.Rows.Count; i++)
{
listBox1.Items.Add(dt.Rows[i]["course_id"].ToString());
listBox1.Items.Add(dt.Rows[i]["book_isbn"].ToString());
listBox1.Items.Add(dt.Rows[i]["book_title"].ToString());
}
I am getting an error in the line da.Fill(ds, "texts");
When I am not using a natural join and doing a simple query, I am getting the correct output. WHat is wrong with the code?