同じテーブルを同時に複数人で変更する問題をフルマッチングで解決

26960 ワード


Partial Class User
    Inherits System.Web.UI.Page

    Private Sub BindData()
        Using sds As SqlDataSource = New SqlDataSource("Data Source=.;Initial Catalog=master;User ID=sa;Password=Abcdefg1", "select * from t_user order by usernumb desc")
            Me.GridView1.DataSource = sds
            Me.GridView1.DataBind()
        End Using
    End Sub

    Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
        Me.GridView1.PageIndex = e.NewPageIndex
        Me.GridView1.EditIndex = -1
        Me.BindData()
    End Sub

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        If Request.Cookies("username") IsNot Nothing And Request.Cookies("userpass") IsNot Nothing Then
            Dim username As String = HttpUtility.UrlDecode(Request.Cookies("username").Value)
            Dim userpass As String = HttpUtility.UrlDecode(Request.Cookies("userpass").Value)
            Using sds As SqlDataSource = New SqlDataSource("Data Source=.;Initial Catalog=master;User ID=sa;Password=Abcdefg1", "select count(*) from t_user where username = @username and userpass = @userpass and a = 1")
                sds.SelectParameters.Add("username", username)
                sds.SelectParameters.Add("userpass", userpass)
                Dim i As Integer = DirectCast(sds.Select(DataSourceSelectArguments.Empty), System.Data.DataView)(0)(0)
                If i = 0 Then
                    Response.Redirect("~/Index.aspx")
                End If
            End Using
        Else
            Response.Redirect("~/Default.aspx")
        End If
        If Not IsPostBack Then
            Me.BindData()
        End If
    End Sub

    Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView1.RowCancelingEdit
        Me.GridView1.EditIndex = -1
        Me.BindData()
    End Sub

    Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        Dim s As String = e.CommandName
        If s.Equals("insert") Then
            Dim username As String = DirectCast(Me.GridView1.FooterRow.FindControl("txt_username"), TextBox).Text
            Dim userpass As String = DirectCast(Me.GridView1.FooterRow.FindControl("txt_userpass"), TextBox).Text
            Dim ba As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_a"), CheckBox).Checked
            Dim bb As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_b"), CheckBox).Checked
            Dim bc As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_c"), CheckBox).Checked
            Dim bd As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_d"), CheckBox).Checked
            Dim be As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_e"), CheckBox).Checked
            Dim bf As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_f"), CheckBox).Checked
            Dim bg As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_g"), CheckBox).Checked
            Dim bh As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_h"), CheckBox).Checked
            Dim bi As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_i"), CheckBox).Checked
            Dim bj As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_j"), CheckBox).Checked
            Dim bk As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_k"), CheckBox).Checked
            Dim bl As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_l"), CheckBox).Checked
            Dim bm As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_m"), CheckBox).Checked
            Dim bn As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_n"), CheckBox).Checked
            Dim bo As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_o"), CheckBox).Checked
            Dim bp As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_p"), CheckBox).Checked
            Dim bq As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_q"), CheckBox).Checked
            Dim br As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_r"), CheckBox).Checked
            Dim bs As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_s"), CheckBox).Checked
            Dim bt As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_t"), CheckBox).Checked
            Dim bu As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_u"), CheckBox).Checked
            Dim bv As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_v"), CheckBox).Checked
            Dim bw As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_w"), CheckBox).Checked
            Dim bx As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_x"), CheckBox).Checked
            Dim by As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_y"), CheckBox).Checked
            Dim bz As Boolean = DirectCast(Me.GridView1.FooterRow.FindControl("cb_z"), CheckBox).Checked

            Using sds As SqlDataSource = New SqlDataSource("Data Source=.;Initial Catalog=master;User ID=sa;Password=Abcdefg1", "")
                sds.SelectParameters.Add("username", username)
                Dim i As Integer = DirectCast(sds.Select(DataSourceSelectArguments.Empty), System.Data.DataView)(0)(0)
                If i > 0 Then
                    Response.Write(" !")
                    Return
                End If
                sds.InsertCommand = "insert into t_user (username, userpass, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) values (@username, @userpass, @a, @b, @c, @d, @e, @f, @g, @h, @i, @j, @k, @l, @m, @n, @o, @q, @q, @r, @s, @t, @u, @v, @w, @x, @y, @z)"
                sds.InsertParameters.Add("username", username)
                sds.InsertParameters.Add("userpass", userpass)
                sds.InsertParameters.Add("a", ba)
                sds.InsertParameters.Add("b", bb)
                sds.InsertParameters.Add("c", bc)
                sds.InsertParameters.Add("d", bd)
                sds.InsertParameters.Add("e", be)
                sds.InsertParameters.Add("f", bf)
                sds.InsertParameters.Add("g", bg)
                sds.InsertParameters.Add("h", bh)
                sds.InsertParameters.Add("i", bi)
                sds.InsertParameters.Add("j", bj)
                sds.InsertParameters.Add("k", bk)
                sds.InsertParameters.Add("l", bl)
                sds.InsertParameters.Add("m", bm)
                sds.InsertParameters.Add("n", bn)
                sds.InsertParameters.Add("o", bo)
                sds.InsertParameters.Add("p", bp)
                sds.InsertParameters.Add("q", bq)
                sds.InsertParameters.Add("r", br)
                sds.InsertParameters.Add("s", bs)
                sds.InsertParameters.Add("t", bt)
                sds.InsertParameters.Add("u", bu)
                sds.InsertParameters.Add("v", bv)
                sds.InsertParameters.Add("w", bw)
                sds.InsertParameters.Add("x", bx)
                sds.InsertParameters.Add("y", by)
                sds.InsertParameters.Add("z", bz)
                sds.Insert()
            End Using
            Me.GridView1.EditIndex = -1
            Me.BindData()
        End If
    End Sub

    Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
        Dim username_old As String = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("lbl_username"), Label).Text
        Dim userpass_old As String = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("lbl_userpass"), Label).Text
        Dim a_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_a"), CheckBox).Checked
        Dim b_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_b"), CheckBox).Checked
        Dim c_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_c"), CheckBox).Checked
        Dim d_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_d"), CheckBox).Checked
        Dim e_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_e"), CheckBox).Checked
        Dim f_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_f"), CheckBox).Checked
        Dim g_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_g"), CheckBox).Checked
        Dim h_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_h"), CheckBox).Checked
        Dim i_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_i"), CheckBox).Checked
        Dim j_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_j"), CheckBox).Checked
        Dim k_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_k"), CheckBox).Checked
        Dim l_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_l"), CheckBox).Checked
        Dim m_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_m"), CheckBox).Checked
        Dim n_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_n"), CheckBox).Checked
        Dim o_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_o"), CheckBox).Checked
        Dim p_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_p"), CheckBox).Checked
        Dim q_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_q"), CheckBox).Checked
        Dim r_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_r"), CheckBox).Checked
        Dim s_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_s"), CheckBox).Checked
        Dim t_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_t"), CheckBox).Checked
        Dim u_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_u"), CheckBox).Checked
        Dim v_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_v"), CheckBox).Checked
        Dim w_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_w"), CheckBox).Checked
        Dim x_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_x"), CheckBox).Checked
        Dim y_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_y"), CheckBox).Checked
        Dim z_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_z"), CheckBox).Checked
        Dim p_user_id As String = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_p_user_id"), HiddenField).Value
        Using sds As SqlDataSource = New SqlDataSource("Data Source=.;Initial Catalog=master;User ID=sa;Password=Abcdefg1", "")
            sds.DeleteCommand = "delete from t_user where username = @username_old and userpass = @userpass_old and a = @a_old and b = @b_old and c = @c_old and d = @d_old and e = @e_old and f = @f_old and g = @g_old and h = @h_old and i = @i_old and j = @j_old and k = @k_old and l = @l_old and m = @m_old and n = @n_old and o = @o_old and p = @p_old and q = @q_old and r = @r_old and s = @s_old and t = @t_old and u = @u_old and v = @v_old and w = @w_old and x = @x_old and y= @y_old and z = @z_old and p_user_id = @p_user_id"
            sds.DeleteParameters.Add("username_old", username_old)
            sds.DeleteParameters.Add("userpass_old", userpass_old)
            sds.DeleteParameters.Add("a_old", a_old)
            sds.DeleteParameters.Add("b_old", b_old)
            sds.DeleteParameters.Add("c_old", c_old)
            sds.DeleteParameters.Add("d_old", d_old)
            sds.DeleteParameters.Add("e_old", e_old)
            sds.DeleteParameters.Add("f_old", e_old)
            sds.DeleteParameters.Add("g_old", e_old)
            sds.DeleteParameters.Add("h_old", h_old)
            sds.DeleteParameters.Add("i_old", i_old)
            sds.DeleteParameters.Add("j_old", j_old)
            sds.DeleteParameters.Add("k_old", k_old)
            sds.DeleteParameters.Add("l_old", l_old)
            sds.DeleteParameters.Add("m_old", m_old)
            sds.DeleteParameters.Add("n_old", n_old)
            sds.DeleteParameters.Add("o_old", o_old)
            sds.DeleteParameters.Add("p_old", p_old)
            sds.DeleteParameters.Add("q_old", q_old)
            sds.DeleteParameters.Add("r_old", r_old)
            sds.DeleteParameters.Add("s_old", s_old)
            sds.DeleteParameters.Add("t_old", t_old)
            sds.DeleteParameters.Add("u_old", u_old)
            sds.DeleteParameters.Add("v_old", v_old)
            sds.DeleteParameters.Add("w_old", w_old)
            sds.DeleteParameters.Add("x_old", x_old)
            sds.DeleteParameters.Add("y_old", y_old)
            sds.DeleteParameters.Add("z_old", z_old)
            sds.DeleteParameters.Add("p_user_id", p_user_id)
            If sds.Delete() > 0 Then
                Response.Write(" ")
            End If
        End Using
        Me.GridView1.EditIndex = -1
        Me.BindData()
    End Sub

    Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
        Me.GridView1.EditIndex = e.NewEditIndex
        Me.BindData()
    End Sub

    Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
        Dim username_new As String = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("txt_username"), TextBox).Text
        Dim userpass_new As String = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("txt_userpass"), TextBox).Text
        Dim a_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_a"), CheckBox).Checked
        Dim b_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_b"), CheckBox).Checked
        Dim c_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_c"), CheckBox).Checked
        Dim d_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_d"), CheckBox).Checked
        Dim e_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_e"), CheckBox).Checked
        Dim f_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_f"), CheckBox).Checked
        Dim g_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_g"), CheckBox).Checked
        Dim h_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_h"), CheckBox).Checked
        Dim i_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_i"), CheckBox).Checked
        Dim j_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_j"), CheckBox).Checked
        Dim k_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_k"), CheckBox).Checked
        Dim l_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_l"), CheckBox).Checked
        Dim m_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_m"), CheckBox).Checked
        Dim n_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_n"), CheckBox).Checked
        Dim o_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_o"), CheckBox).Checked
        Dim p_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_p"), CheckBox).Checked
        Dim q_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_q"), CheckBox).Checked
        Dim r_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_r"), CheckBox).Checked
        Dim s_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_s"), CheckBox).Checked
        Dim t_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_t"), CheckBox).Checked
        Dim u_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_u"), CheckBox).Checked
        Dim v_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_v"), CheckBox).Checked
        Dim w_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_w"), CheckBox).Checked
        Dim x_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_x"), CheckBox).Checked
        Dim y_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_y"), CheckBox).Checked
        Dim z_new As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("cb_z"), CheckBox).Checked
        Dim username_old As String = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_username"), HiddenField).Value
        Dim userpass_old As String = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_userpass"), HiddenField).Value
        Dim a_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_a"), HiddenField).Value
        Dim b_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_b"), HiddenField).Value
        Dim c_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_c"), HiddenField).Value
        Dim d_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_d"), HiddenField).Value
        Dim e_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_e"), HiddenField).Value
        Dim f_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_f"), HiddenField).Value
        Dim g_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_g"), HiddenField).Value
        Dim h_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_h"), HiddenField).Value
        Dim i_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_i"), HiddenField).Value
        Dim j_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_j"), HiddenField).Value
        Dim k_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_k"), HiddenField).Value
        Dim l_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_l"), HiddenField).Value
        Dim m_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_m"), HiddenField).Value
        Dim n_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_n"), HiddenField).Value
        Dim o_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_o"), HiddenField).Value
        Dim p_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_p"), HiddenField).Value
        Dim q_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_q"), HiddenField).Value
        Dim r_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_r"), HiddenField).Value
        Dim s_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_s"), HiddenField).Value
        Dim t_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_t"), HiddenField).Value
        Dim u_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_u"), HiddenField).Value
        Dim v_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_v"), HiddenField).Value
        Dim w_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_w"), HiddenField).Value
        Dim x_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_x"), HiddenField).Value
        Dim y_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_y"), HiddenField).Value
        Dim z_old As Boolean = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_z"), HiddenField).Value
        Dim p_user_id As String = DirectCast(Me.GridView1.Rows(e.RowIndex).FindControl("hf_p_user_id"), HiddenField).Value

        Using sds As SqlDataSource = New SqlDataSource("Data Source=.;Initial Catalog=master;User ID=sa;Password=Abcdefg1", "select count(*) from t_user where username = @username")
            If Not username_old.Equals(username_new) Then
                sds.SelectParameters.Add("username", username_new)
                Dim i As Integer = DirectCast(sds.Select(DataSourceSelectArguments.Empty), System.Data.DataView)(0)(0)
                If i > 0 Then
                    Response.Write(" !")
                    Return
                End If
            End If
            sds.UpdateCommand = "update t_user set username = @username_new, userpass = @userpass_new, a = @a_new, b = @b_new, c = @c_new, d = @d_new, e = @e_new, f = @f_new, g = @g_new, h = @h_new, i = @i_new, j = @j_new, k = @k_new, l = @l_new, m = @m_new, n = @n_new, o = @o_new, p = @p_new, q = @q_new, r = @r_new, s = @s_new, t = @t_new, u = @u_new, v = @v_new, w = @w_new, x = @x_new, y = @y_new, z = @z_new where username = @username_old and userpass = @userpass_old and a = @a_old and b = @b_old and c = @c_old and d = @d_old and e = @e_old and f = @f_old and g = @g_old and h = @h_old and i = @i_old and j = @j_old and k = @k_old and l = @l_old and m = @m_old and n = @n_old and o = @o_old and p = @p_old and q = @q_old and r = @r_old and s = @s_old and t = @t_old and u = @u_old and v = @v_old and w = @w_old and x = @x_old and y= @y_old and z = @z_old and p_user_id = @p_user_id"
            sds.UpdateParameters.Add("username_new", username_new)
            sds.UpdateParameters.Add("userpass_new", userpass_new)
            sds.UpdateParameters.Add("a_new", a_new)
            sds.UpdateParameters.Add("b_new", b_new)
            sds.UpdateParameters.Add("c_new", c_new)
            sds.UpdateParameters.Add("d_new", d_new)
            sds.UpdateParameters.Add("e_new", e_new)
            sds.UpdateParameters.Add("f_new", e_new)
            sds.UpdateParameters.Add("g_new", e_new)
            sds.UpdateParameters.Add("h_new", h_new)
            sds.UpdateParameters.Add("i_new", i_new)
            sds.UpdateParameters.Add("j_new", j_new)
            sds.UpdateParameters.Add("k_new", k_new)
            sds.UpdateParameters.Add("l_new", l_new)
            sds.UpdateParameters.Add("m_new", m_new)
            sds.UpdateParameters.Add("n_new", n_new)
            sds.UpdateParameters.Add("o_new", o_new)
            sds.UpdateParameters.Add("p_new", p_new)
            sds.UpdateParameters.Add("q_new", q_new)
            sds.UpdateParameters.Add("r_new", r_new)
            sds.UpdateParameters.Add("s_new", s_new)
            sds.UpdateParameters.Add("t_new", t_new)
            sds.UpdateParameters.Add("u_new", u_new)
            sds.UpdateParameters.Add("v_new", v_new)
            sds.UpdateParameters.Add("w_new", w_new)
            sds.UpdateParameters.Add("x_new", x_new)
            sds.UpdateParameters.Add("y_new", y_new)
            sds.UpdateParameters.Add("z_new", z_new)
            sds.UpdateParameters.Add("username_old", username_old)
            sds.UpdateParameters.Add("userpass_old", userpass_old)
            sds.UpdateParameters.Add("a_old", a_old)
            sds.UpdateParameters.Add("b_old", b_old)
            sds.UpdateParameters.Add("c_old", c_old)
            sds.UpdateParameters.Add("d_old", d_old)
            sds.UpdateParameters.Add("e_old", e_old)
            sds.UpdateParameters.Add("f_old", e_old)
            sds.UpdateParameters.Add("g_old", e_old)
            sds.UpdateParameters.Add("h_old", h_old)
            sds.UpdateParameters.Add("i_old", i_old)
            sds.UpdateParameters.Add("j_old", j_old)
            sds.UpdateParameters.Add("k_old", k_old)
            sds.UpdateParameters.Add("l_old", l_old)
            sds.UpdateParameters.Add("m_old", m_old)
            sds.UpdateParameters.Add("n_old", n_old)
            sds.UpdateParameters.Add("o_old", o_old)
            sds.UpdateParameters.Add("p_old", p_old)
            sds.UpdateParameters.Add("q_old", q_old)
            sds.UpdateParameters.Add("r_old", r_old)
            sds.UpdateParameters.Add("s_old", s_old)
            sds.UpdateParameters.Add("t_old", t_old)
            sds.UpdateParameters.Add("u_old", u_old)
            sds.UpdateParameters.Add("v_old", v_old)
            sds.UpdateParameters.Add("w_old", w_old)
            sds.UpdateParameters.Add("x_old", x_old)
            sds.UpdateParameters.Add("y_old", y_old)
            sds.UpdateParameters.Add("z_old", z_old)
            sds.UpdateParameters.Add("p_user_id", p_user_id)
            If sds.Update() > 0 Then
                Response.Write(" ")
            End If
            Me.GridView1.EditIndex = -1
            Me.BindData()
        End Using
    End Sub
End Class