Hi, posting because when i click on update button on the gridview, gives me this error. My teacher already tried and nothing, but if i use another Database he can do it well.
I will be copy the code backdown.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body background="Fundos/padrao1.png">
<form id="form1" runat="server">
<div style="text-align: center">
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/Fundos/Logotipo2.png" PostBackUrl="~/PagAdmin.aspx" Width="944px" />
</div>
<p style="text-align: center">
<asp:Label ID="Label1" runat="server" BorderColor="Red" BorderStyle="Solid"
Font-Size="X-Large" ForeColor="White" Height="26px" Text="Editar/Eliminar"
Width="418px"></asp:Label>
</p>
<table align="center" class="style1" style="text-align: center">
<tr>
<td>
</td>
<td>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
CellPadding="3" CellSpacing="2" DataKeyNames="Id_Artigo"
DataSourceID="AccessDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="Id_Artigo" HeaderText="Id_Artigo" ReadOnly="True"
SortExpression="Id_Artigo" />
<asp:BoundField DataField="Marca" HeaderText="Marca" SortExpression="Marca" />
<asp:BoundField DataField="Modelo" HeaderText="Modelo"
SortExpression="Modelo" />
<asp:BoundField DataField="Preço" DataFormatString="{0:c}" HeaderText="Preço"
SortExpression="Preço" />
<asp:BoundField DataField="Tipo" HeaderText="Tipo" SortExpression="Tipo" />
<asp:BoundField DataField="Stock" HeaderText="Stock" SortExpression="Stock" />
<asp:BoundField DataField="Imagem" HeaderText="Imagem" SortExpression="Imagem"
Visible="False" />
<asp:ImageField DataImageUrlField="Imagem" HeaderText="Imagem">
<ControlStyle Height="200px" Width="200px" />
<ItemStyle Height="30px" Width="60px" />
</asp:ImageField>
</Columns>
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#FFF1D4" />
<SortedAscendingHeaderStyle BackColor="#B95C30" />
<SortedDescendingCellStyle BackColor="#F1E5CE" />
<SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/SI.accdb"
DeleteCommand="DELETE FROM [Artigos] WHERE (([Id_Artigo] = ?) OR ([Id_Artigo] IS NULL AND ? IS NULL))"
InsertCommand="INSERT INTO [Artigos] ([Id_Artigo], [Marca], [Modelo], [Preço], [Tipo], [Imagem], [Stock]) VALUES (?, ?, ?, ?, ?, ?, ?)"
SelectCommand="SELECT * FROM [Artigos]"
UpdateCommand="UPDATE [Artigos] SET [Marca] = ?, [Modelo] = ?, [Preço] = ?, [Tipo] = ?, [Imagem] = ?, [Stock] = ? WHERE (([Id_Artigo] = ?) OR ([Id_Artigo] IS NULL AND ? IS NULL))">
<DeleteParameters>
<asp:Parameter Name="Id_Artigo" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Id_Artigo" Type="Int32" />
<asp:Parameter Name="Marca" Type="String" />
<asp:Parameter Name="Modelo" Type="String" />
<asp:Parameter Name="Preço" Type="Decimal" />
<asp:Parameter Name="Tipo" Type="Int32" />
<asp:Parameter Name="Imagem" Type="String" />
<asp:Parameter Name="Stock" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="Marca" Type="String" />
<asp:Parameter Name="Modelo" Type="String" />
<asp:Parameter Name="Preço" Type="Decimal" />
<asp:Parameter Name="Tipo" Type="Int32" />
<asp:Parameter Name="Imagem" Type="String" />
<asp:Parameter Name="Stock" Type="String" />
<asp:Parameter Name="Id_Artigo" Type="Int32" />
</UpdateParameters>
</asp:AccessDataSource>
</td>
<td>
</td>
</tr>
</table>
</form>
</body>
</html>