Estoy tratando de realizer un Update
a los registros que tengo en mi base de datos en Access
al principio funcionaba y cambiaba todos los registros por que no tenia un id = id
, despues lo coloque en el Query
pero ya no funciona nada, no hace ningun Update
este es mi codigo:
string myConnectionString = @"C:\\Users\\gutiece\\Desktop\\database\\" + "Database1.accdb";
using (OleDbConnection connection = new OleDbConnection())
{
using (OleDbCommand command = new OleDbCommand())
{
connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0; Data source= " + myConnectionString;
command.Connection = connection;
connection.Open();
command.Parameters.AddWithValue("@ID", Convert.ToInt32(Txt_id.Text));
command.Parameters.AddWithValue("@STATUS", Dpo_status.Text.Trim());
command.Parameters.AddWithValue("@AREA", Dpo_buckets.Text.Trim());
command.Parameters.AddWithValue("@TOOL", Txt_tool.Text.Trim());
command.Parameters.AddWithValue("@RESPONSABLE", Txt_resp.Text.Trim());
command.Parameters.AddWithValue("@NOTA", Txt_notas.Text.Trim());
command.Parameters.AddWithValue("@REPAIR", Txt_dates.Text.Trim());
command.CommandText = "UPDATE status_change SET status = @STATUS, area = @AREA, tool = @TOOL, responsable = @RESPONSABLE, nota = @NOTA, repair = @REPAIR, repare = 1 WHERE id = @ID";
command.ExecuteNonQuery();
Response.Redirect("dashboard.aspx");
connection.Close();
}
}
y este es el codigo del Panel
:
<asp:Panel ID="PanelEdit" runat="server" CssClass="panel panel-primary" Width="750px" Style="display: none">
<asp:Panel ID="panelEditTitle" runat="server" CssClass="panel-heading">
<h3 align="center"><span><i class="fa fa-reply" aria-hidden="true">  Re-Assign Tool</i></span></h3>
</asp:Panel>
<div class="panel-body">
<div align="center">
<div class="input-group col-xs-9" style="display: none">
<span class="input-group-addon">id</span>
<asp:TextBox ID="Txt_id" runat="server" class="form-control" AutoComplete="off" Enabled="False"></asp:TextBox>
</div>
 
<div class="input-group col-xs-9">
<span class="input-group-addon">Responsable</span>
<asp:TextBox runat="server" type="text" ID="Txt_resp" class="form-control" ReadOnly="true"></asp:TextBox>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Txt_resp" Display="None" ErrorMessage="You miss a responsable" ValidationGroup="edit"></asp:RequiredFieldValidator>
 
<div class="input-group col-xs-9">
<span class="input-group-addon">Area</span>
<asp:DropDownList ID="Dpo_buckets" CssClass="form-control" runat="server" Enabled="False">
<asp:ListItem>MCH</asp:ListItem>
</asp:DropDownList>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="Txt_tool" Display="None" ErrorMessage="You miss the tool" ValidationGroup="edit"></asp:RequiredFieldValidator>
 
<div class="input-group col-xs-9">
<span class="input-group-addon">Tool</span>
<asp:TextBox runat="server" type="text" ID="Txt_tool" class="form-control" ReadOnly="true" />
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="Txt_tool" Display="None" ErrorMessage="You miss the tool" ValidationGroup="edit"></asp:RequiredFieldValidator>
 
<div class="input-group col-xs-9">
<span class="input-group-addon">Status</span>
<asp:DropDownList ID="Dpo_status" CssClass="form-control" runat="server" Enabled="False">
</asp:DropDownList>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="Dpo_status" Display="None" ErrorMessage="Select a status" ValidationGroup="edit"></asp:RequiredFieldValidator>
 
<div class="input-group col-xs-9">
<span class="input-group-addon">Nota</span>
<asp:TextBox ID="Txt_notas" runat="server" type="text" class="form-control"/>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="Txt_notas" Display="None" ErrorMessage="You need to assign a note" ValidationGroup="edit"></asp:RequiredFieldValidator>
 
<div class="input-group col-xs-9">
<span class="input-group-addon">Date</span>
<asp:TextBox ID="Txt_dates" runat="server" type="text" class="form-control" ReadOnly="true"/>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="Txt_dates" Display="None" ErrorMessage="Select the current date" ValidationGroup="edit"></asp:RequiredFieldValidator>
 
<div class="panel-footer">
<asp:Button ID="SubmitBT" runat="server" Text="Submit" CssClass="btn btn-primary" ValidationGroup="edit" OnClick="SubmitBT_Click" />
<asp:Button ID="DismissBT" runat="server" Text="Dismiss" CssClass="btn btn-primary" CausesValidation="false" />
</div>
</div>
</div>
</asp:Panel>