kgenn 0 Light Poster
Protected Sub Gridview1_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs)
        
        Dim txtR, txtP, txtC, txtCo, txtB, txtL, txtF, txtM, txtPo, txtSu, txtS As TextBox
     
        Dim row As GridViewRow = GridView1.Rows(e.RowIndex)
        txtR = CType(row.Cells(1).Controls(0), TextBox)
        txtP = CType(row.Cells(2).Controls(0), TextBox)
        txtC = CType(row.Cells(3).Controls(0), TextBox)
        txtB = CType(row.Cells(4).Controls(0), TextBox)
        txtCo = CType(row.Cells(5).Controls(0), TextBox)
        txtPo = CType(row.Cells(6).Controls(0), TextBox)
        txtL = CType(row.Cells(7).Controls(0), TextBox)
        txtF = CType(row.Cells(8).Controls(0), TextBox)
        txtM = CType(row.Cells(9).Controls(0), TextBox)
        txtSu = CType(row.Cells(10).Controls(0), TextBox)
        txtS = CType(row.Cells(11).Controls(0), TextBox)
         
        Dim connection As OleDbConnection
        connection = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\Karl Gennadi\Desktop\Visual Studio 2008\WebSite3\Database\dbLupon.mdb")
        
        
        Dim command As OleDbCommand
        command = New OleDbCommand("UPDATE tblLUPON_C SET POSITION_C = @POSITION_C, LAST_M = @LAST_M, FIRST_M = @FIRST_M, MIDDLE_M = @MIDDLE_M, SUFFIX_M = @SUFFIX_M, SEX_C = @SEX_C WHERE REGION_C = @REGION_C AND PROVINCE_C = @PROVINCE_C AND CITYMUN_C = @CITYMUN_C AND BARANGAY_C = @BARANGAY_C AND COUNT_C = @COUNT_C", connection)
        command.Parameters.AddWithValue("@REGION_C", txtR.Text)
        command.Parameters.AddWithValue("@PROVINCE_C", txtP.Text)
        command.Parameters.AddWithValue("@CITYMUN_C", txtC.Text)
        command.Parameters.AddWithValue("@BARANGAY_C", txtB.Text)
        command.Parameters.AddWithValue("@COUNT_C", txtCo.Text)
        command.Parameters.AddWithValue("@POSITION_C", txtCo.Text)
        command.Parameters.AddWithValue("@LAST_M", txtL.Text)
        command.Parameters.AddWithValue("@FIRST_M", txtF.Text)
        command.Parameters.AddWithValue("@MIDDLE_M", txtM.Text)
        command.Parameters.AddWithValue("@SUFFIX_M", txtSu.Text)
        command.Parameters.AddWithValue("@SEX_C", txtS.Text) 

        'Try
        connection.Open()

        command.ExecuteNonQuery()
        '  Catch ex As Exception
        'MsgBox(ex.ToString)
        ' Finally
        connection.Close()
        
        GridView1.EditIndex = -1
        Call BindGrid()
        'End Try
    End Sub

that is my update code for gridview.. it doesn't work. why?
is it because of my where clause?
please help me. please
it doesn't return any errors but it didn't work :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.