为什么只能修改部分纪录
vs2008 web编程用sqldatasoure组件选定数据表,gridview控件显示数据,并有修改纪录得功能。
数据显示正常。并可以修改前19条记录。但第20条以后就修改不了。仔细看了一下。前
十九条记录是从1开始连续的记录,第二十条就不连续了。这是咋回事,为啥就不能修改了? --------------------编程问答-------------------- 贴HTML --------------------编程问答-------------------- gridview是从0开始的 0 1 2 3 4 5.。19 第20条是19吧 你仔细看看是否是序列错了 --------------------编程问答--------------------
id wareName wareSize uintA warePrice uintB imgPath dataTime TypeId
编辑 删除 选择 1 YG222 512.00 1 50.00 2 images/Ware/no-picture.gif 2009-6-15 12:00:05 1
编辑 删除 选择 2 YG242 9.00 1 350.00 3 images/Ware/242.jpg 2009-6-15 12:00:05 2
编辑 删除 选择 3 YG243 50.00 1 250.00 2 images/Ware/243.jpg 2009-6-15 12:00:05 2
编辑 删除 选择 4 YG262 0.00 1 4.25 3 images/Ware/262.jpg 2009-6-15 12:00:05 2
编辑 删除 选择 5 YG271 0.00 1 0.50 3 images/Ware/271.jpg 2009-6-15 12:00:05 2
编辑 删除 选择 6 YG272 50.00 1 250.00 2 images/Ware/no-picture.gif 2009-6-15 12:00:05 2
编辑 删除 选择 7 YG277 50.00 1 250.00 2 images/Ware/277.jpg 2009-6-15 12:00:05 2
编辑 删除 选择 8 YG290 500.00 1 280.00 2 images/Ware/no-picture.gif 2009-6-15 12:00:05 2
编辑 删除 选择 9 YG545 50.00 1 250.00 2 images/Ware/545.jpg 2009-6-15 12:00:05 1
编辑 删除 选择 10 YG554 800.00 1 280.00 2 images/Ware/no-picture.gif 2009-6-15 12:00:05 1
编辑 删除 选择 11 YG565 200.00 1 310.00 2 images/Ware/no-picture.gif 2009-6-15 12:00:05 1
编辑 删除 选择 12 YG567 250.00 1 310.00 2 images/Ware/no-picture.gif 2009-6-15 12:00:05 1
编辑 删除 选择 17 YG577 300.00 1 305.00 2 images/Ware/no-picture.gif 2009-6-15 12:00:05 1
编辑 删除 选择 18 YG510 600.00 1 270.00 2 images/Ware/no-picture.gif 2009-6-15 12:00:05 3
编辑 删除 选择 19 YG515 0.00 1 0.05 3 images/Ware/no-picture.gif 2009-6-15 12:00:05 3
编辑 删除 选择 43 aa 44.00 1 55.00 2 images/Ware/尼龙搭扣---4CM.JPG 2009-7-23 12:05:51 2
编辑 删除 选择 44 ad 678.00 1 856.00 2 images/Ware/尼龙搭扣---10CM.JPG 2009-7-23 12:11:27 2
编辑 删除 选择 45 132 1223.00 1 123.00 2 images/Ware/尼龙搭扣---5CM.JPG 2009-7-23 13:02:31 2
编辑 删除 选择 46 zhhzh 1313.00 1 1313.00 2 images/Ware/尼龙搭扣---6CM.JPG 2009-7-23 13:56:03 1
编辑 删除 选择 50 供应12.5MM背胶魔术贴、自粘型粘扣带 900.00 1 600.00 2 images/Ware/sdasd.jpg 2009-7-28 12:13:58 1
编辑 删除 选择 51 手机魔术贴50cm*70cm 600.00 1 800.00 2 images/Ware/Phone.jpg 2009-7-28 12:49:17 1
编辑 删除 选择 52 护腕魔术贴 100.00 1 400.00 2 images/Ware/huwan.jpg 2009-7-28 12:55:32 1
编辑 删除 选择 53 测试产品 1.00 1 2.00 2 2009-8-6 15:52:45 1
编辑 删除 选择 54 测试产品 1.00 1 2.00 2 2009-8-6 15:53:04 1
--------------------编程问答-------------------- 你贴的不是html代码啊 --------------------编程问答-------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test-bind.aspx.cs" Inherits="test_bind" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:XWSShoppingConnectionString %>"
DeleteCommand="DELETE FROM [Ware] WHERE [id] = @original_id AND [wareName] = @original_wareName AND [wareSize] = @original_wareSize AND [uintA] = @original_uintA AND [warePrice] = @original_warePrice AND [uintB] = @original_uintB AND [imgPath] = @original_imgPath AND [dataTime] = @original_dataTime AND [TypeId] = @original_TypeId"
InsertCommand="INSERT INTO [Ware] ([wareName], [wareSize], [uintA], [warePrice], [uintB], [imgPath], [dataTime], [TypeId]) VALUES (@wareName, @wareSize, @uintA, @warePrice, @uintB, @imgPath, @dataTime, @TypeId)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM [Ware]"
UpdateCommand="UPDATE [Ware] SET [wareName] = @wareName, [wareSize] = @wareSize, [uintA] = @uintA, [warePrice] = @warePrice, [uintB] = @uintB, [imgPath] = @imgPath, [dataTime] = @dataTime, [TypeId] = @TypeId WHERE [id] = @original_id AND [wareName] = @original_wareName AND [wareSize] = @original_wareSize AND [uintA] = @original_uintA AND [warePrice] = @original_warePrice AND [uintB] = @original_uintB AND [imgPath] = @original_imgPath AND [dataTime] = @original_dataTime AND [TypeId] = @original_TypeId">
<DeleteParameters>
<asp:Parameter Name="original_id" Type="Int32" />
<asp:Parameter Name="original_wareName" Type="String" />
<asp:Parameter Name="original_wareSize" Type="Decimal" />
<asp:Parameter Name="original_uintA" Type="String" />
<asp:Parameter Name="original_warePrice" Type="Decimal" />
<asp:Parameter Name="original_uintB" Type="String" />
<asp:Parameter Name="original_imgPath" Type="String" />
<asp:Parameter Name="original_dataTime" Type="DateTime" />
<asp:Parameter Name="original_TypeId" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="wareName" Type="String" />
<asp:Parameter Name="wareSize" Type="Decimal" />
<asp:Parameter Name="uintA" Type="String" />
<asp:Parameter Name="warePrice" Type="Decimal" />
<asp:Parameter Name="uintB" Type="String" />
<asp:Parameter Name="imgPath" Type="String" />
<asp:Parameter Name="dataTime" Type="DateTime" />
<asp:Parameter Name="TypeId" Type="Int32" />
<asp:Parameter Name="original_id" Type="Int32" />
<asp:Parameter Name="original_wareName" Type="String" />
<asp:Parameter Name="original_wareSize" Type="Decimal" />
<asp:Parameter Name="original_uintA" Type="String" />
<asp:Parameter Name="original_warePrice" Type="Decimal" />
<asp:Parameter Name="original_uintB" Type="String" />
<asp:Parameter Name="original_imgPath" Type="String" />
<asp:Parameter Name="original_dataTime" Type="DateTime" />
<asp:Parameter Name="original_TypeId" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="wareName" Type="String" />
<asp:Parameter Name="wareSize" Type="Decimal" />
<asp:Parameter Name="uintA" Type="String" />
<asp:Parameter Name="warePrice" Type="Decimal" />
<asp:Parameter Name="uintB" Type="String" />
<asp:Parameter Name="imgPath" Type="String" />
<asp:Parameter Name="dataTime" Type="DateTime" />
<asp:Parameter Name="TypeId" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="id" DataSourceID="SqlDataSource1" AllowSorting="True">
<Columns>
<asp:CommandField ShowEditButton="True" ShowDeleteButton="True"
ShowSelectButton="True" />
<asp:BoundField DataField="id" HeaderText="id" InsertVisible="False"
ReadOnly="True" SortExpression="id" />
<asp:BoundField DataField="wareName" HeaderText="wareName"
SortExpression="wareName" />
<asp:BoundField DataField="wareSize" HeaderText="wareSize"
SortExpression="wareSize" />
<asp:BoundField DataField="uintA" HeaderText="uintA" SortExpression="uintA" />
<asp:BoundField DataField="warePrice" HeaderText="warePrice"
SortExpression="warePrice" />
<asp:BoundField DataField="uintB" HeaderText="uintB" SortExpression="uintB" />
<asp:BoundField DataField="imgPath" HeaderText="imgPath"
SortExpression="imgPath" />
<asp:BoundField DataField="dataTime" HeaderText="dataTime"
SortExpression="dataTime" />
<asp:BoundField DataField="TypeId" HeaderText="TypeId"
SortExpression="TypeId" />
</Columns>
</asp:GridView>
</form>
</body>
</html>
--------------------编程问答-------------------- 代码是vs2008 自动生成的,我只设置了两个控件。 --------------------编程问答-------------------- 用SqlDataSource控件啊...
没搞过
还是自己写吧 --------------------编程问答-------------------- 估计中文编码引起的吧 --------------------编程问答-------------------- 楼上能说具体点吗? --------------------编程问答-------------------- 只是把sqldatasource中的属性中高级中的并发控制去掉就行了。按这种方法可以用了。谁能来解释一下?
补充:.NET技术 , ASP.NET