更新前输入如下数据:

点击更新按钮后再次回到该界面:

图中使用的FormView代码如下:
好像一切都正常,到底问题出在哪里那?
[解决方法]
把Update语句中字段的顺序调整为和FormView中的字段顺序一致就可以了,看来.net2.0还是不够智能阿
点击更新按钮后再次回到该界面:
图中使用的FormView代码如下:
<asp:FormView ID="FormView1" runat="server" DataSourceID="mstiger">
<EditItemTemplate>
左图片Url:
<asp:TextBox ID="LeftImgUrlTextBox" runat="server" Text='<%# Bind("LeftImgUrl") %>'></asp:TextBox>
宽度:
<asp:TextBox ID="LeftImgWidthTextBox" runat="server" Text='<%# Bind("LeftImgWidth") %>'></asp:TextBox>
高度:
<asp:TextBox ID="LeftImgHeightTextBox" runat="server" Text='<%# Bind("LeftImgHeight") %>'></asp:TextBox><br />
<br />
中图Url:
<asp:TextBox ID="MiddleImgUrlTextBox" runat="server" Text='<%# Bind("MiddleImgUrl") %>'></asp:TextBox>
宽度::
<asp:TextBox ID="MiddleImgWidthTextBox" runat="server" Text='<%# Bind("MiddleImgWidth") %>'></asp:TextBox>
高度::
<asp:TextBox ID="MiddleImgHeightTextBox" runat="server" Text='<%# Bind("MiddleImgHeight") %>'></asp:TextBox><br />
右图Url:
<asp:TextBox ID="RightImgUrlTextBox" runat="server" Text='<%# Bind("RightImgUrl") %>'></asp:TextBox>
宽度:
<asp:TextBox ID="RightImgWidthTextBox" runat="server" Text='<%# Bind("RightImgWidth") %>'></asp:TextBox>
高度:
<asp:TextBox ID="RightImgHeightTextBox" runat="server" Text='<%# Bind("RightImgHeight") %>'></asp:TextBox><br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="更新"></asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
左图片url:
<asp:Label ID="LeftImgUrlLabel" runat="server" Text='<%# Bind("LeftImgUrl") %>'></asp:Label>
宽度:
<asp:Label ID="LeftImgWidthLabel" runat="server" Text='<%# Bind("LeftImgWidth") %>'></asp:Label>
高度:
<asp:Label ID="LeftImgHeightLabel" runat="server" Text='<%# Bind("LeftImgHeight") %>'></asp:Label><br />
中间图片Url:
<asp:Label ID="MiddleImgUrlLabel" runat="server" Text='<%# Bind("MiddleImgUrl") %>'></asp:Label>
宽度::
<asp:Label ID="MiddleImgWidthLabel" runat="server" Text='<%# Bind("MiddleImgWidth") %>'></asp:Label>
高度:
<asp:Label ID="MiddleImgHeightLabel" runat="server" Text='<%# Bind("MiddleImgHeight") %>'></asp:Label><br />
<br />
右图片Url:
<asp:Label ID="RightImgUrlLabel" runat="server" Text='<%# Bind("RightImgUrl") %>'></asp:Label>
宽度:
<asp:Label ID="RightImgWidthLabel" runat="server" Text='<%# Bind("RightImgWidth") %>'></asp:Label>
高度:
<asp:Label ID="RightImgHeightLabel" runat="server" Text='<%# Bind("RightImgHeight") %>'></asp:Label><br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
Text="编辑"></asp:LinkButton>
</ItemTemplate>
</asp:FormView>
该FormView对应的AccessDataSource如下:<EditItemTemplate>
左图片Url:
<asp:TextBox ID="LeftImgUrlTextBox" runat="server" Text='<%# Bind("LeftImgUrl") %>'></asp:TextBox>
宽度:
<asp:TextBox ID="LeftImgWidthTextBox" runat="server" Text='<%# Bind("LeftImgWidth") %>'></asp:TextBox>
高度:
<asp:TextBox ID="LeftImgHeightTextBox" runat="server" Text='<%# Bind("LeftImgHeight") %>'></asp:TextBox><br />
<br />
中图Url:
<asp:TextBox ID="MiddleImgUrlTextBox" runat="server" Text='<%# Bind("MiddleImgUrl") %>'></asp:TextBox>
宽度::
<asp:TextBox ID="MiddleImgWidthTextBox" runat="server" Text='<%# Bind("MiddleImgWidth") %>'></asp:TextBox>
高度::
<asp:TextBox ID="MiddleImgHeightTextBox" runat="server" Text='<%# Bind("MiddleImgHeight") %>'></asp:TextBox><br />
右图Url:
<asp:TextBox ID="RightImgUrlTextBox" runat="server" Text='<%# Bind("RightImgUrl") %>'></asp:TextBox>
宽度:
<asp:TextBox ID="RightImgWidthTextBox" runat="server" Text='<%# Bind("RightImgWidth") %>'></asp:TextBox>
高度:
<asp:TextBox ID="RightImgHeightTextBox" runat="server" Text='<%# Bind("RightImgHeight") %>'></asp:TextBox><br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="更新"></asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
左图片url:
<asp:Label ID="LeftImgUrlLabel" runat="server" Text='<%# Bind("LeftImgUrl") %>'></asp:Label>
宽度:
<asp:Label ID="LeftImgWidthLabel" runat="server" Text='<%# Bind("LeftImgWidth") %>'></asp:Label>
高度:
<asp:Label ID="LeftImgHeightLabel" runat="server" Text='<%# Bind("LeftImgHeight") %>'></asp:Label><br />
中间图片Url:
<asp:Label ID="MiddleImgUrlLabel" runat="server" Text='<%# Bind("MiddleImgUrl") %>'></asp:Label>
宽度::
<asp:Label ID="MiddleImgWidthLabel" runat="server" Text='<%# Bind("MiddleImgWidth") %>'></asp:Label>
高度:
<asp:Label ID="MiddleImgHeightLabel" runat="server" Text='<%# Bind("MiddleImgHeight") %>'></asp:Label><br />
<br />
右图片Url:
<asp:Label ID="RightImgUrlLabel" runat="server" Text='<%# Bind("RightImgUrl") %>'></asp:Label>
宽度:
<asp:Label ID="RightImgWidthLabel" runat="server" Text='<%# Bind("RightImgWidth") %>'></asp:Label>
高度:
<asp:Label ID="RightImgHeightLabel" runat="server" Text='<%# Bind("RightImgHeight") %>'></asp:Label><br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
Text="编辑"></asp:LinkButton>
</ItemTemplate>
</asp:FormView>
<asp:AccessDataSource ID="mstiger" runat="server" DataFile="~/db/mstiger.mdb" SelectCommand="SELECT DISTINCT LeftImgUrl,LeftImgWidth, LeftImgHeight,MiddleImgUrl, MiddleImgWidth, MiddleImgHeight, RightImgUrl,RightImgWidth, RightImgHeight FROM GeneralProperties" UpdateCommand="UPDATE GeneralProperties SET LeftImgUrl = @LeftImgUrl, MiddleImgUrl = @MiddleImgUrl, RightImgUrl = @RightImgUrl, LeftImgWidth = @LeftImgWidth , LeftImgHeight =@LeftImgHeight , MiddleImgWidth = @MiddleImgWidth , MiddleImgHeight =@MiddleImgHeight , RightImgWidth =@RightImgWidth , RightImgHeight = @RightImgHeight">
</asp:AccessDataSource>
</asp:AccessDataSource>
好像一切都正常,到底问题出在哪里那?
[解决方法]
把Update语句中字段的顺序调整为和FormView中的字段顺序一致就可以了,看来.net2.0还是不够智能阿
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架