Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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();
        dr.Read();
        cmd.CommandText = qry1;
        cmd.ExecuteNonQuery();
        cmd.CommandText = qry2;
        cmd.ExecuteNonQuery();
        cmd.CommandText = qry3;
        cmd.ExecuteNonQuery();
Posted 5-Jan-13 20:04pm
Comments
Zoltán Zörgő at 6-Jan-13 3:02am
   
What exactly would be this "easy Method"?
pankajgarg1986 at 6-Jan-13 3:13am
   
how to execute multiple select query in easy way
Rate this: bad
good
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 + "'";
  Permalink  
Comments
pankajgarg1986 at 6-Jan-13 23:03pm
   
Thanks Pallavi waikar.Nice reply form you.i really thanksfull to you
pankajgarg1986 at 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 at 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
0 Kornfeld Eliyahu Peter 430
1 OriginalGriff 304
2 Nelek 115
3 Sergey Alexandrovich Kryukov 99
4 Gihan Liyanage 99
0 Kornfeld Eliyahu Peter 420
1 OriginalGriff 140
2 Gihan Liyanage 99
3 Nelek 65
4 sankarsan parida 65


Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2014
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