My datagrid isn't updating the right value . I type the value into the record and hit update, and instead of updating the record w/ the value I put in the TxtBx it will update w/ the value from the last record in the datagrid.
Ie. it's updating the right record, but w/ the value from the last record of the datagrid.
THANKS
Ie. it's updating the right record, but w/ the value from the last record of the datagrid.
Code:
Dim Dgi As DataGridItem
For Each Dgi In Me.Dg.Items
Dim AdventId As String = Convert.ToString(Dg.DataKeys(Dgi.ItemIndex))
Dim MgrId As String = CType(Dgi.FindControl("LblMgrID"), Label).Text
Dim Manager As String = CType(Dgi.FindControl("txtManager"), TextBox).Text
Dim MgrIdParam As New SqlParameter("@MgrId", SqlDbType.VarChar)
MgrIdParam.Direction = ParameterDirection.Input
Dim AdvParam As New SqlParameter("@AdventId", SqlDbType.VarChar)
AdvParam.Direction = ParameterDirection.Input
Dim MgrParam As New SqlParameter("@Manager", SqlDbType.VarChar)
MgrParam.Direction = ParameterDirection.Input
Dim DaUpdate As New SqlDataAdapter
DaUpdate.UpdateCommand = New SqlCommand
DaUpdate.UpdateCommand.Connection = SqlConn1
DaUpdate.UpdateCommand.CommandText = "Sp_UpdateReconData"
DaUpdate.UpdateCommand.CommandType = CommandType.StoredProcedure
DaUpdate.UpdateCommand.Parameters.Add(MgrIdParam)
DaUpdate.UpdateCommand.Parameters("@MgrId").Value = "10dr"
DaUpdate.UpdateCommand.Parameters.Add(AdvParam)
DaUpdate.UpdateCommand.Parameters("@AdventId").Value = AdventId
DaUpdate.UpdateCommand.Parameters.Add(MgrParam)
DaUpdate.UpdateCommand.Parameters("@Manager").Value = Manager
SqlConn1.Open()
DaUpdate.UpdateCommand.ExecuteNonQuery()
SqlConn1.Close()
Next
THANKS