ADO.NET - Populating multi-table dataset in MS Access


I'm trying to figure out how to populate a dataset with 2 tables in ADO.NET.  The code below should work but it doesn't.  It throws an exception at the line 'da.Fill(dSetWF)' saying 'Characters found after end of SQL statement.'  I believe this is because microsoft Access doesn't allow multi statement queries.  What is the best way to accomplish what I am trying to do?


Here is my code:

dSetWF = new DataSetWorkflow();  //dSetWF is a typed dataset

OleDbDataAdapter da = new OleDbDataAdapter("select * from workflow; select * from comments;", cnWF);
da.TableMappings.Add("Table", "Workflow");
da.TableMappings.Add("Table1", "Comments");

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Two separate queries?

dSetWF = new DataSetWorkflow();  //dSetWF is a typed dataset

OleDbDataAdapter daWorkflow = new OleDbDataAdapter("select * from workflow", cnWF);
OleDbDataAdapter daComments = new OleDbDataAdapter("select * from comments", cnWF);


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
prosh0tAuthor Commented:
i was just hoping there was a more elegant way to do keep this confined to 1 data adapter... is this impossible with ms access?

prosh0tAuthor Commented:
i forgot to mention this is access 97

I don't believe the JET driver supports batch queries.


"Access databases cannot return multiple Recordset objects because Microsoft Jet SQL statements do not support multiple SELECT statements."

This is in reference to ADO but it will apply to ADO.NET as well
prosh0tAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.