I have a stored procedure that is run from a single button click on an aspx page. I have the image change at the end when the stored procedure runs successfully. I want to change the image also WHILE the stored procedure is running. The image I want to change to is an animated gif.
protected void btnSubmit_Click(object sender, ImageClickEventArgs e)
btnSubmit.ImageUrl = "~/images/cog.gif";
System.Data.SqlClient.SqlConnection oConn = new System.Data.SqlClient.SqlConnection();
System.Data.SqlClient.SqlCommand oCmd = new System.Data.SqlClient.SqlCommand();
oConn.ConnectionString = ConfigurationManager.ConnectionStrings["man_pilotConnectionString"].ConnectionString;
oCmd.Connection = oConn;
oCmd.CommandText = "aer_deactivate_recipes";
oCmd.CommandType = CommandType.StoredProcedure;
oCmd.Parameters.Add("@user", SqlDbType.VarChar, 25).Value = Label2.Text;
System.Data.SqlClient.SqlConnection oConn2 = new System.Data.SqlClient.SqlConnection();
System.Data.SqlClient.SqlCommand oCmd2 = new System.Data.SqlClient.SqlCommand();
oConn2.ConnectionString = ConfigurationManager.ConnectionStrings["fin_pilotConnectionString"].ConnectionString;
oCmd2.Connection = oConn2;
oCmd2.CommandText = "AER_UPDATE_PART_UOM_CONVERSIONS";
oCmd2.CommandType = CommandType.StoredProcedure;
btnSubmit.ImageUrl = "~/images/Halo.gif";
Label1.Text = "Wasn't that easy??";
catch (Exception ex)
btnSubmit.ImageUrl = "~/images/failure.jpg";
Label1.Text = "Woops. Something went awry: " + ex.Message;
The image at the end changes successfully when the stored procedure is finished, but it takes several seconds for the sproc to run. I put the image change as the first action on the button click, before the sproc starts. I have also tried putting as the first action under the try block. What am I missing to get this image to change while the stored procedure is running?
Ultimately, I also want to get the page to play a sound when everything is finished. This is an application that is run once per year on January 1st and I try to make it "fun" and "different" every year since they have to work on the 1st.