กดปุ่ม update ข้อมูลไม่ได้ Error "No value given for one or more required parameters" (ASP.NET)
ผมตัวช่วยสร้างของ ASP.NET ไม่ได้เขียนโค๊ดเอง
Code (VB.NET)
<head>
<style type="text/css">
.style1
{
width: 102px;
}
.style2
{
width: 122px;
}
</style>
</head>
<form id="form1" runat="server">
<asp:AccessDataSource ID="AccessDataSource2" runat="server"
ConflictDetection="CompareAllValues" DataFile="~/App_Data/Database2.mdb"
DeleteCommand="DELETE FROM [Table1] WHERE (([ID] = ?) OR ([ID] IS NULL AND ? IS NULL)) AND (([ref] = ?) OR ([ref] IS NULL AND ? IS NULL)) AND (([ean] = ?) OR ([ean] IS NULL AND ? IS NULL))"
InsertCommand="INSERT INTO [Table1] ([ID], [ref], [ean]) VALUES (?, ?, ?)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM [Table1]"
UpdateCommand="UPDATE [Table1] SET [ref] = ?, [ean] = ? WHERE (([ID] = ?) OR ([ID] IS NULL AND ? IS NULL)) AND (([ref] = ?) OR ([ref] IS NULL AND ? IS NULL)) AND (([ean] = ?) OR ([ean] IS NULL AND ? IS NULL))">
<DeleteParameters>
<asp:Parameter Name="original_ID" Type="String" />
<asp:Parameter Name="original_ref" Type="String" />
<asp:Parameter Name="original_ean" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ref" Type="String" />
<asp:Parameter Name="ean" Type="String" />
<asp:Parameter Name="original_ID" Type="String" />
<asp:Parameter Name="original_ref" Type="String" />
<asp:Parameter Name="original_ean" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="String" />
<asp:Parameter Name="ref" Type="String" />
<asp:Parameter Name="ean" Type="String" />
</InsertParameters>
</asp:AccessDataSource>
<asp:FormView ID="FormView1" runat="server" BackColor="LightGoldenrodYellow"
BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataKeyNames="ID"
DataSourceID="AccessDataSource2" ForeColor="Black">
<FooterStyle BackColor="Tan" />
<EditItemTemplate>
<table style="width: 88%;">
<tr>
<td class="style1">
แก้ไข</td>
<td class="style2">
</td>
<td>
</td>
</tr>
<tr>
<td class="style1">
รหัสสินค้า</td>
<td class="style2">
<asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
</td>
<td>
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
</td>
</tr>
<tr>
<td class="style1">
ชื่อสินค้า</td>
<td class="style2">
<asp:TextBox ID="refTextBox" runat="server" Text='<%# Bind("ref") %>' />
</td>
<td class="style1">
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</td>
</tr>
<tr>
<td class="style1">
บาร์โค๊ด</td>
<td class="style2">
<asp:TextBox ID="eanTextBox" runat="server" Text='<%# Bind("ean") %>' />
</td>
<td>
</td>
</tr>
</table>
</EditItemTemplate>
<InsertItemTemplate>
ID:
<asp:TextBox ID="IDTextBox" runat="server" Text='<%# Bind("ID") %>' />
<br />
ref:
<asp:TextBox ID="refTextBox" runat="server" Text='<%# Bind("ref") %>' />
<br />
ean:
<asp:TextBox ID="eanTextBox" runat="server" Text='<%# Bind("ean") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
<br />
<table style="width: 88%;">
<tr>
<td class="style1">
ทะเบียนสินค้า</td>
<td class="style2">
</td>
<td>
</td>
</tr>
<tr>
<td class="style1">
รหัสสินค้า</td>
<td class="style2">
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
</td>
<td>
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False"
CommandName="New" Text="เพิ่มข้อมูลสินค้า" />
<asp:Button ID="Button1" runat="server" CausesValidation="False"
CommandName="new" Text="Button" />
</td>
</tr>
<tr>
<td class="style1">
ชื่อสินค้า</td>
<td class="style2">
<asp:Label ID="refLabel" runat="server" Text='<%# Bind("ref") %>' />
</td>
<td>
<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False"
CommandName="Delete" Text="ลบข้อมูลสินค้า" />
</td>
</tr>
<tr>
<td class="style1">
บาร์โค๊ด</td>
<td class="style2">
<asp:Label ID="eanLabel" runat="server" Text='<%# Bind("ean") %>' />
</td>
<td>
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False"
CommandName="Edit" Text="แก้ไขข้อมูลสินค้า" />
</td>
</tr>
</table>
<br />
<br />
</ItemTemplate>
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
HorizontalAlign="Center" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<EditRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
</asp:FormView>
<br />
</form>
Date :
2012-07-07 01:49:37
By :
mrcool_307
Load balance : Server 04