Click here to Skip to main content
13,251,399 members (57,052 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Pls Help Me.How To do This in easy Method.Select query in one line.Thanks in advance

string qry = "select advtcountryid from advt where advtcountryid='" + countryid + "'";
        string qry1 = "select agencycountryid from agency where agencycountryid='" + countryid + "'";
        string qry2 = "select clientcountryid from client where clientcountryid='" + countryid + "'";
        string qry3 = "select statecountryid from state where statecountryid='" + countryid + "'";
        MySqlConnection con =new MySqlConnection(common.GetConnectionString());
        MySqlDataReader dr = new MySqlDataReader();
        MySqlTransaction tran = con.BeginTransaction(IsolationLevel.ReadCommitted);
        MySqlCommand cmd = new MySqlCommand(qry, con, tran);
        cmd.Transaction = tran;
        dr = cmd.ExecuteReader();
        cmd.CommandText = qry1;
        cmd.CommandText = qry2;
        cmd.CommandText = qry3;
Posted 5-Jan-13 21:04pm
Zoltán Zörgő 6-Jan-13 3:02am
What exactly would be this "easy Method"?
pankajgarg1986 6-Jan-13 3:13am
how to execute multiple select query in easy way
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

u have do somthing like this query........

string qry=select a.advtcountryid ,ag.agencycountryid,c.clientcountryid ,s.statecountryid  from agency a,agency ag,client c,state  s
 where a.advtcountryid='" + countryid + "' and ag.agencycountryid='" + countryid + "' and c.clientcountryid='" + countryid + "' and s.countryid + ='" + countryid + "'";
pankajgarg1986 6-Jan-13 23:03pm
Thanks Pallavi waikar.Nice reply form you.i really thanksfull to you
pankajgarg1986 6-Jan-13 23:08pm
What why this query return Large amount of rows.In databse there are less records something 30 rows.but this query returns 308 rows.Pls find solution.
Pallavi waikar 7-Jan-13 0:57am
how should i know his database...i wrote here he has to use joins and have some connection in then..that was an exampal...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100