我在我所下列字段,如圖圖像的形式:如何使用ASP.NET一次更新SQL Server 2008的單個行?
下面是其中我有三個插入3個不同的值3不同的行數據庫的屏幕截圖,但是當我更新了其中的一行,所有三行都得到了更新。
這裏是更新的代碼我有SqlDataSource
:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ToursandTravelsConnectionString %>"
SelectCommand="SELECT [subcatname], [subcatid], [categoryname] FROM [subcategory]"
UpdateCommand="UPDATE subcategory SET subcatname [email protected], categoryname [email protected], pic [email protected]">
<UpdateParameters>
<asp:ControlParameter ControlID="txtsubcategoryname" Name="1"
PropertyName="Text" />
<asp:ControlParameter ControlID="txtcategoryname" Name="2"
PropertyName="Text" />
<asp:ControlParameter ControlID="FileUpload1" Name="3"
PropertyName="FileBytes" />
</UpdateParameters>
</asp:SqlDataSource>
這裏是控制代替其中我已經使用@ 1,@ 2的圖像,@ 3 [https://i.stack.imgur.com/zLOEI.jpg] –