Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code suddenly stopped working
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Code suddenly stopped working
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01347992
Message ID:
01347992
Views:
62
Hi everybody,

Here is the code I tested about a day ago and it worked fine. Today it's either not working, or working but incorrectly and I could not figure out what's wrong. The record is getting deleted from the table in SQL Server, but the GridView still shows it. Only if I refresh the GridView (there is a button on the form to bring all records), I see that the records are really gone. Also no message is displayed on the page to undelete the person.

Do you see what may be wrong?

Or is it a time to re-start computer?

Thanks in advance.
int pi = (ProfilesGrid.PageIndex * 20) + e.RowIndex;

            TextBox tb;
            if (this.ProfilesGrid.Rows.Count <= pi)
            {
              tb = (TextBox)  this.ProfilesGrid.Rows[e.RowIndex].Cells[13].Controls[0]; }
                else{
                   tb = (TextBox) this.ProfilesGrid.Rows[pi].Cells[13].Controls[0];
            }
            int id = (int)Convert.ToInt16(tb.Text.ToString()); //this.ProfilesGrid.Rows[pi].Cells[14] )

            string SQL = "UPDATE People SET Deleted = 1 WHERE PersonID = " + id;
            //        e.CommandArgument;
            Util.DoCmd(SQL);

            // pi -= 1;

            if (Session["dts"] != null)
            {
                DataSet dts = (DataSet)Session["dts"];
                this.DeletedPersonRow = dts.Tables[0].Rows[pi]; //Save Person we're about to delete
                Session["DeletedPersonRow"] = this.DeletedPersonRow;                
                this.DeletedRowIndex = pi;
                ViewState["DeletedRowIndex"] = this.DeletedRowIndex; 
                dts.Tables[0].Rows[pi].Delete();
                dts.AcceptChanges();
                ProfilesGrid.DataSource = dts;
                ProfilesGrid.DataBind();                
                Session["dts"]= dts;

            }
            // NN 05-08-08 - added LinkButton on the page itself rather than adding in run-time
            LinkButton UndoDel = (LinkButton)this.plchStatusControls.FindControl("UndoDel");

            UndoDel.Text = "Undo";
            UndoDel.Visible = true;
            UndoDel.CommandName = "Undelete";
            UndoDel.CausesValidation = false;
            clseditmode.personid = id.ToString() ; // e.Keys["PersonID"].ToString();

            UndoDel.CommandArgument = id.ToString();// e.Keys["PersonID"].ToString();
            this.DisplayMessage("Removed " + PersonName + " click to ");
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform