Question : How to execute two queries simultaneously

Experts
please see the attached image and the error there.
Now please suggest me how to execute the two queries simultaneously.

Apart from my attempt in this if there is a better way to execute the same then please let me know .
Thanking you,
Anindya
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
private void display_companyName_atUpdateMode()
        {
            Int32 comID = 0;
            using (SqlConnection con = new SqlConnection(Connectionstring.Connection))
            {
                string query = "select CompanyID from Table_Interaction where InteractionID='" +Convert.ToInt32( InteractionID.ToString() )+ "' ";
                using (SqlCommand cmd = new SqlCommand(query, con))
                {
                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    if (!reader.HasRows) return;
                    while (reader.Read())
                    {
                        comID=Convert.ToInt32(string.Format("{0}",reader[0]));
                        string query2 = "select CompanyName from Table_Client where CompanyID=@param";
                        SqlCommand cmd2 = new SqlCommand(query2, con);
                        cmd2.Parameters.AddWithValue("@param", comID);
                        SqlDataReader reader1 = cmd2.ExecuteReader();
                        if (!reader1.HasRows) return;
                        while (reader.Read())
                        {
                            comboBox_client.Text = string.Format("{0}", reader1[0]);
                        }


                    }
                }
            }
                 
        }
Attachments:
 
 
 
 

Answer : How to execute two queries simultaneously

Random Solutions  
 
programming4us programming4us