MYSql With C# in Multiple Query

Halo, the following are my code.

string sqlString = "select * FROM JobInfo WHERE JobNo='135'; select * FROM TraderRelated WHERE JobNo='135';select * FROM DeliveryInfo WHERE JobNo='135'; ";

MySqlDataAdapter Adapter = new MySqlDataAdapter();
MySqlCommand cmdSelect   = new MySqlCommand();

cmdSelect.CommandText = sqlString;
cmdSelect.CommandType = CommandType.Text;
cmdSelect.Connection  = GetConnection;
Adapter.SelectCommand = cmdSelect;
Adapter.Fill(ds);

The following coding is work fine with MYSql version 4.0.22, but when i upgrade my MYSql server to Version 4.1, then i'm getting error
[ You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';' at line 1]

Please help....
carrotchuaAsked:
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.

JakobACommented:
You have several seperate select commands in your sqlString (separated by ';'. that is not always a legal thing to do. How should mySQL determine how to return a single resultset with rows found on that query.

Generally I would combine the 3 queries into a single query that acces a join of all 3 tables:

string sqlString = "select * FROM JobInfo JOIN TraderRelated USING JobNo JOIN DeliveryInfo USING JobNo WHERE JobNo='135'; ";

You may need to say  JobInfo.JobNo  instead of just JobNo in the WHERE clause, but try without first.

regards JakobA
0

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
JakobACommented:
I paste your reply in here as it mistakenly arrived in my personal feedback.

soory for the late response, I do not check my feedback often. (it is intended for personal feedback, ie complaint if I am abusive, or praise if I manage to be exceptionally helpfull)

--------------------------------

    *
      Thanks for ur comment, but i want to fill up  a DataSet with 3 DataTable. This code is work fine in Version 4.0 . It return a dataset with 3 datatable, but it not work in Version 4.1.

      Please advice

--------------------------------

Unfortunately I cannot adwice further as I do not knoe the C# interface to MySQL well enough to comment on version-problems.

The error you get point to ';' as the problem supporting the original guess, but as you no doubt know, errormessages are not always reliable so It may well be something else.

regards jakobA
0
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
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.