B
bgreer5050
When I try and update using the gridview edit option, all of the
records in the entire Access database
get changed. Is this normal in gridview? Is there a way to change
this behavior? Or should I
be using a different control?
Thanks
Page Code is as follows:
<%@ Page Language="VB" %>
<!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>Search Parts By Mfr Bumber</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/
Main.aspx" Style="position: relative; left: 0px; top: -15px;">Goto
Main Page</asp:HyperLink>
<asp:Button ID="Button1" runat="server" Style="left: 249px;
position: relative; top: 73px; z-index: 100;"
Text="Search" />
<asp:Label ID="Label1" runat="server" Style="z-index: 104;
left: 167px; position: absolute;
top: 48px" Text="Enter A Partial Part Number"
Width="230px" Font-Size="14pt"></asp:Label>
<br />
<asp:TextBox ID="TextBox1" runat="server" Style="left: 187px;
position: relative;
top: 49px; z-index: 102;"></asp:TextBox><br />
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/
add_data_inventory.aspx"
Style="left: 0px; position: relative; top: -33px"
Width="141px">Goto Add Data Page</asp:HyperLink><br />
</div>
<br />
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
ConflictDetection="CompareAllValues"
DataFile="~/App_Data/Spare_Parts_II_BCPC.mdb"
DeleteCommand="DELETE FROM [Inventory] WHERE [ID1] = ? AND [Mfr] = ?
AND [MFR_PART#] = ? AND [Description] = ? AND [Shelving Unit] = ? AND
[Shelf] = ? AND [Bin#] = ? AND [OnHand] = ?"
InsertCommand="INSERT INTO [Inventory] ([Mfr],
[MFR_PART#], [Description], [Shelving Unit], [Shelf], [Bin#],
[OnHand], [ID1]) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT [Mfr], [MFR_PART#] AS column1, [Description],
[Shelving Unit] AS Shelving_Unit, [Shelf], [Bin#] AS column2,
[OnHand], [ID1] FROM [Inventory] WHERE ([MFR_PART#] LIKE '%' + ? +
'%')"
UpdateCommand="UPDATE [Inventory] SET [Mfr] = ?,
[MFR_PART#] = ?, [Description] = ?, [Shelving Unit] = ?, [Shelf] = ?,
[Bin#] = ?, [OnHand] = ? AND [Mfr] = ? AND [MFR_PART#] = ? AND
[Description] = ? AND [Shelving Unit] = ? AND [Shelf] = ? AND [Bin#]
= ? AND [OnHand] = ?">
<DeleteParameters>
<asparameter Name="original_ID1" Type="Int32" />
<asparameter Name="original_Description"
Type="String" />
<asparameter Name="original_Shelving_Unit"
Type="String" />
<asparameter Name="original_OnHand" Type="Double" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="Mfr" Type="String" />
<asparameter Name="column1" Type="String" />
<asparameter Name="Description" Type="String" />
<asparameter Name="Shelving_Unit" Type="String" />
<asparameter Name="Shelf" Type="String" />
<asparameter Name="column2" Type="String" />
<asparameter Name="OnHand" Type="Double" />
<asparameter Name="original_ID1" Type="Int32" />
<asparameter Name="original_Description"
Type="String" />
<asparameter Name="original_Shelving_Unit"
Type="String" />
<asparameter Name="original_OnHand" Type="Double" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1"
Name="column1" PropertyName="Text" Type="String" />
</SelectParameters>
<InsertParameters>
<asparameter Name="Mfr" Type="String" />
<asparameter Name="column1" Type="String" />
<asparameter Name="Description" Type="String" />
<asparameter Name="Shelving_Unit" Type="String" />
<asparameter Name="Shelf" Type="String" />
<asparameter Name="column2" Type="String" />
<asparameter Name="OnHand" Type="Double" />
<asparameter Name="ID1" Type="Int32" />
</InsertParameters>
</asp:AccessDataSource>
<br />
<br />
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="ID1" DataSourceID="AccessDataSource1"
ForeColor="#333333" GridLines="None"
Style="position: relative">
<FooterStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="Mfr" HeaderText="Mfr"
SortExpression="Mfr" />
<asp:BoundField DataField="column1"
HeaderText="Mfr_Part_no" SortExpression="column1" />
<asp:BoundField DataField="Description"
HeaderText="Description" SortExpression="Description" />
<asp:BoundField DataField="Shelving_Unit"
HeaderText="Shelving_Unit" SortExpression="Shelving_Unit" />
<asp:BoundField DataField="Shelf" HeaderText="Shelf"
SortExpression="Shelf" />
<asp:BoundField DataField="column2"
HeaderText="Bin_No" SortExpression="column2" />
<asp:BoundField DataField="OnHand" HeaderText="OnHand"
SortExpression="OnHand" />
<asp:BoundField DataField="ID1" HeaderText="ID1"
InsertVisible="False" ReadOnly="True"
SortExpression="ID1" />
</Columns>
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True"
ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333"
HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</form>
</body>
</html>
records in the entire Access database
get changed. Is this normal in gridview? Is there a way to change
this behavior? Or should I
be using a different control?
Thanks
Page Code is as follows:
<%@ Page Language="VB" %>
<!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>Search Parts By Mfr Bumber</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/
Main.aspx" Style="position: relative; left: 0px; top: -15px;">Goto
Main Page</asp:HyperLink>
<asp:Button ID="Button1" runat="server" Style="left: 249px;
position: relative; top: 73px; z-index: 100;"
Text="Search" />
<asp:Label ID="Label1" runat="server" Style="z-index: 104;
left: 167px; position: absolute;
top: 48px" Text="Enter A Partial Part Number"
Width="230px" Font-Size="14pt"></asp:Label>
<br />
<asp:TextBox ID="TextBox1" runat="server" Style="left: 187px;
position: relative;
top: 49px; z-index: 102;"></asp:TextBox><br />
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/
add_data_inventory.aspx"
Style="left: 0px; position: relative; top: -33px"
Width="141px">Goto Add Data Page</asp:HyperLink><br />
</div>
<br />
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
ConflictDetection="CompareAllValues"
DataFile="~/App_Data/Spare_Parts_II_BCPC.mdb"
DeleteCommand="DELETE FROM [Inventory] WHERE [ID1] = ? AND [Mfr] = ?
AND [MFR_PART#] = ? AND [Description] = ? AND [Shelving Unit] = ? AND
[Shelf] = ? AND [Bin#] = ? AND [OnHand] = ?"
InsertCommand="INSERT INTO [Inventory] ([Mfr],
[MFR_PART#], [Description], [Shelving Unit], [Shelf], [Bin#],
[OnHand], [ID1]) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT [Mfr], [MFR_PART#] AS column1, [Description],
[Shelving Unit] AS Shelving_Unit, [Shelf], [Bin#] AS column2,
[OnHand], [ID1] FROM [Inventory] WHERE ([MFR_PART#] LIKE '%' + ? +
'%')"
UpdateCommand="UPDATE [Inventory] SET [Mfr] = ?,
[MFR_PART#] = ?, [Description] = ?, [Shelving Unit] = ?, [Shelf] = ?,
[Bin#] = ?, [OnHand] = ? AND [Mfr] = ? AND [MFR_PART#] = ? AND
[Description] = ? AND [Shelving Unit] = ? AND [Shelf] = ? AND [Bin#]
= ? AND [OnHand] = ?">
<DeleteParameters>
<asparameter Name="original_ID1" Type="Int32" />
<asparameter Name="original_Description"
Type="String" />
<asparameter Name="original_Shelving_Unit"
Type="String" />
<asparameter Name="original_OnHand" Type="Double" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="Mfr" Type="String" />
<asparameter Name="column1" Type="String" />
<asparameter Name="Description" Type="String" />
<asparameter Name="Shelving_Unit" Type="String" />
<asparameter Name="Shelf" Type="String" />
<asparameter Name="column2" Type="String" />
<asparameter Name="OnHand" Type="Double" />
<asparameter Name="original_ID1" Type="Int32" />
<asparameter Name="original_Description"
Type="String" />
<asparameter Name="original_Shelving_Unit"
Type="String" />
<asparameter Name="original_OnHand" Type="Double" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1"
Name="column1" PropertyName="Text" Type="String" />
</SelectParameters>
<InsertParameters>
<asparameter Name="Mfr" Type="String" />
<asparameter Name="column1" Type="String" />
<asparameter Name="Description" Type="String" />
<asparameter Name="Shelving_Unit" Type="String" />
<asparameter Name="Shelf" Type="String" />
<asparameter Name="column2" Type="String" />
<asparameter Name="OnHand" Type="Double" />
<asparameter Name="ID1" Type="Int32" />
</InsertParameters>
</asp:AccessDataSource>
<br />
<br />
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="ID1" DataSourceID="AccessDataSource1"
ForeColor="#333333" GridLines="None"
Style="position: relative">
<FooterStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="Mfr" HeaderText="Mfr"
SortExpression="Mfr" />
<asp:BoundField DataField="column1"
HeaderText="Mfr_Part_no" SortExpression="column1" />
<asp:BoundField DataField="Description"
HeaderText="Description" SortExpression="Description" />
<asp:BoundField DataField="Shelving_Unit"
HeaderText="Shelving_Unit" SortExpression="Shelving_Unit" />
<asp:BoundField DataField="Shelf" HeaderText="Shelf"
SortExpression="Shelf" />
<asp:BoundField DataField="column2"
HeaderText="Bin_No" SortExpression="column2" />
<asp:BoundField DataField="OnHand" HeaderText="OnHand"
SortExpression="OnHand" />
<asp:BoundField DataField="ID1" HeaderText="ID1"
InsertVisible="False" ReadOnly="True"
SortExpression="ID1" />
</Columns>
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True"
ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333"
HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</form>
</body>
</html>