简体   繁体   中英

Execute SQL scripts consecutively

I'm in a situation where I need to execute sql script one after the other. The next script will be executed only if the return value of the previous script is 0. Also, I need to feed my ASP.NET Page with the statuses of the script collection, whether it's completed, on-going, cancelled or error. I'm trying to accomplish this with PageAsyncTask and by Threading but those doesn't produce the output. Any recommendation is welcome.

Edit:

I populate a gridview with an sql table where I place the log entries. Entries are treated in the gridview differently so I manage them in the RowDataBound event of the gridview. Each link button serves a method.

protected void gvProgress_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                #region CONTROL ASSIGNMENT

HtmlImage icon = (HtmlImage)e.Row.Cells[0].Controls[1]; Label scriptname = (Label)e.Row.Cells[0].Controls[3]; HiddenField status = (HiddenField)e.Row.Cells[0].Controls[5]; LinkButton details = (LinkButton)e.Row.Cells[4].Controls[1]; LinkButton pop = (LinkButton)e.Row.Cells[4].Controls[3]; LinkButton rerun = (LinkButton)e.Row.Cells[4].Controls[5]; LinkButton cancel = (LinkButton)e.Row.Cells[4].Controls[7]; LinkButton start = (LinkButton)e.Row.Cells[4].Controls[9]; #endregion #region CONTROLS PREPARATION switch (status.Value) { case "1": //Pending/Not Yet Started icon.Src = "icons/pending.png"; details.Visible = false; pop.Visible = false; rerun.Visible = false; cancel.Visible = false; start.Visible = false; break; case "2": //In-Progress icon.Src = "icons/on-going.gif"; details.Visible = false; pop.Visible = false; cancel.Visible = true; rerun.Visible = false; start.Visible = false; break; //did something similar for other statuses } } }

您是否考虑过将它们全部作为事务执行?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM