Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I want to perform multiple sql query with loop and i want these queries perform with some time interval.
C#
SqlConnection sqlconn = new SqlConnection(str);
            sqlconn.Open();
            string strquery;
            strquery = "SELECT Indices_id, IndicesName, LastPrice, ChangePrice * .63 AS 'change of price', Percentage FROM Table1";
            strquery2 = "SELECT Indices_id, IndicesName, LastPrice, ChangePrice * .60 AS 'change of price', Percentage FROM Table1";
            strquery3 = "SELECT Indices_id, IndicesName, LastPrice, ChangePrice * -.60 AS 'change of price', Percentage FROM Table1";
            SqlCommand sqlcmd = new SqlCommand(strquery, sqlconn);
            DataSet ds = new DataSet();
            SqlDataAdapter sda = new SqlDataAdapter();
            sda.SelectCommand = sqlcmd;
            sda.Fill(ds);
            GridView1.DataSource = ds;
            GridView1.DataBind();
Posted
Updated 6-Nov-12 4:58am
v2
Comments
OriginalGriff 6-Nov-12 12:11pm    
And? Your problem is?
Sandeep Mewara 6-Nov-12 17:47pm    
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.
damodara naidu betha 7-Nov-12 0:22am    
you need to get execution time also?

1 solution

try using parallel for loop for this.

here is an eg. of this. you will have much control on each of these SQL queries.

http://msdn.microsoft.com/en-us/library/dd460713.aspx[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900