abnewallo
Starting Member
6 Posts |
Posted - 2006-05-29 : 12:55:07
|
I have developed an application in Visual Web Developer Express and for some reason the update function is not working. When I select update the record reverts to its old information. The following is the ASP code:<%@ Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:XprtDirConnectionString %>" DeleteCommand="DELETE FROM [companyDetails] WHERE [indexNo] = @original_indexNo AND [Title] = @original_Title AND [yearEst] = @original_yearEst AND [employeeCount] = @original_employeeCount AND [Address_1] = @original_Address_1 AND [Address_2] = @original_Address_2 AND [Contacts] = @original_Contacts AND [TelNos] = @original_TelNos AND [FaxNos] = @original_FaxNos AND [emailAddresses] = @original_emailAddresses AND [Website] = @original_Website AND [Categories] = @original_Categories AND [Sub_Categories] = @original_Sub_Categories AND [Services] = @original_Services AND [exportMarkets] = @original_exportMarkets AND [Imports] = @original_Imports AND [importSources] = @original_importSources" InsertCommand="INSERT INTO [companyDetails] ([Title], [yearEst], [employeeCount], [Address_1], [Address_2], [Contacts], [TelNos], [FaxNos], [emailAddresses], [Website], [Categories], [Sub_Categories], [Services], [exportMarkets], [Imports], [importSources]) VALUES (@Title, @yearEst, @employeeCount, @Address_1, @Address_2, @Contacts, @TelNos, @FaxNos, @emailAddresses, @Website, @Categories, @Sub_Categories, @Services, @exportMarkets, @Imports, @importSources)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [companyDetails]" UpdateCommand="UPDATE [companyDetails] SET [Title] = @Title, [yearEst] = @yearEst, [employeeCount] = @employeeCount, [Address_1] = @Address_1, [Address_2] = @Address_2, [Contacts] = @Contacts, [TelNos] = @TelNos, [FaxNos] = @FaxNos, [emailAddresses] = @emailAddresses, [Website] = @Website, [Categories] = @Categories, [Sub_Categories] = @Sub_Categories, [Services] = @Services, [exportMarkets] = @exportMarkets, [Imports] = @Imports, [importSources] = @importSources WHERE [indexNo] = @original_indexNo AND [Title] = @original_Title AND [yearEst] = @original_yearEst AND [employeeCount] = @original_employeeCount AND [Address_1] = @original_Address_1 AND [Address_2] = @original_Address_2 AND [Contacts] = @original_Contacts AND [TelNos] = @original_TelNos AND [FaxNos] = @original_FaxNos AND [emailAddresses] = @original_emailAddresses AND [Website] = @original_Website AND [Categories] = @original_Categories AND [Sub_Categories] = @original_Sub_Categories AND [Services] = @original_Services AND [exportMarkets] = @original_exportMarkets AND [Imports] = @original_Imports AND [importSources] = @original_importSources"> <DeleteParameters> <asp:Parameter Name="original_indexNo" Type="Int32" /> <asp:Parameter Name="original_Title" Type="String" /> <asp:Parameter Name="original_yearEst" Type="Int32" /> <asp:Parameter Name="original_employeeCount" Type="Int32" /> <asp:Parameter Name="original_Address_1" Type="String" /> <asp:Parameter Name="original_Address_2" Type="String" /> <asp:Parameter Name="original_Contacts" Type="String" /> <asp:Parameter Name="original_TelNos" Type="String" /> <asp:Parameter Name="original_FaxNos" Type="String" /> <asp:Parameter Name="original_emailAddresses" Type="String" /> <asp:Parameter Name="original_Website" Type="String" /> <asp:Parameter Name="original_Categories" Type="String" /> <asp:Parameter Name="original_Sub_Categories" Type="String" /> <asp:Parameter Name="original_Services" Type="String" /> <asp:Parameter Name="original_exportMarkets" Type="String" /> <asp:Parameter Name="original_Imports" Type="String" /> <asp:Parameter Name="original_importSources" Type="String" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="Title" Type="String" /> <asp:Parameter Name="yearEst" Type="Int32" /> <asp:Parameter Name="employeeCount" Type="Int32" /> <asp:Parameter Name="Address_1" Type="String" /> <asp:Parameter Name="Address_2" Type="String" /> <asp:Parameter Name="Contacts" Type="String" /> <asp:Parameter Name="TelNos" Type="String" /> <asp:Parameter Name="FaxNos" Type="String" /> <asp:Parameter Name="emailAddresses" Type="String" /> <asp:Parameter Name="Website" Type="String" /> <asp:Parameter Name="Categories" Type="String" /> <asp:Parameter Name="Sub_Categories" Type="String" /> <asp:Parameter Name="Services" Type="String" /> <asp:Parameter Name="exportMarkets" Type="String" /> <asp:Parameter Name="Imports" Type="String" /> <asp:Parameter Name="importSources" Type="String" /> <asp:Parameter Name="original_indexNo" Type="Int32" /> <asp:Parameter Name="original_Title" Type="String" /> <asp:Parameter Name="original_yearEst" Type="Int32" /> <asp:Parameter Name="original_employeeCount" Type="Int32" /> <asp:Parameter Name="original_Address_1" Type="String" /> <asp:Parameter Name="original_Address_2" Type="String" /> <asp:Parameter Name="original_Contacts" Type="String" /> <asp:Parameter Name="original_TelNos" Type="String" /> <asp:Parameter Name="original_FaxNos" Type="String" /> <asp:Parameter Name="original_emailAddresses" Type="String" /> <asp:Parameter Name="original_Website" Type="String" /> <asp:Parameter Name="original_Categories" Type="String" /> <asp:Parameter Name="original_Sub_Categories" Type="String" /> <asp:Parameter Name="original_Services" Type="String" /> <asp:Parameter Name="original_exportMarkets" Type="String" /> <asp:Parameter Name="original_Imports" Type="String" /> <asp:Parameter Name="original_importSources" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="Title" Type="String" /> <asp:Parameter Name="yearEst" Type="Int32" /> <asp:Parameter Name="employeeCount" Type="Int32" /> <asp:Parameter Name="Address_1" Type="String" /> <asp:Parameter Name="Address_2" Type="String" /> <asp:Parameter Name="Contacts" Type="String" /> <asp:Parameter Name="TelNos" Type="String" /> <asp:Parameter Name="FaxNos" Type="String" /> <asp:Parameter Name="emailAddresses" Type="String" /> <asp:Parameter Name="Website" Type="String" /> <asp:Parameter Name="Categories" Type="String" /> <asp:Parameter Name="Sub_Categories" Type="String" /> <asp:Parameter Name="Services" Type="String" /> <asp:Parameter Name="exportMarkets" Type="String" /> <asp:Parameter Name="Imports" Type="String" /> <asp:Parameter Name="importSources" Type="String" /> </InsertParameters> </asp:SqlDataSource> <asp:FormView ID="FormView1" runat="server" CellPadding="4" DataKeyNames="indexNo" DataSourceID="SqlDataSource1" ForeColor="#333333" Style="z-index: 24; left: 0px; position: absolute; top: 0px" Height="456px" Width="900px"> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#999999" /> <EditItemTemplate> Title: <asp:Label ID="TitleLabelName" runat="server" Text='Company Name:' style="z-index: 100; left: 4px; position: absolute; top: 20px" Width="112px"></asp:Label> <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' style="z-index: 100; left: 115px; position: absolute; top: 20px" Width="336px"></asp:TextBox><br /> <asp:Label ID="Year_Est_LabelName" runat="server" Text='Established:' style="z-index: 101; left: 36px; position: absolute; top: 44px" Width="10px"></asp:Label> <asp:TextBox ID="yearEstTextBox" runat="server" Text='<%# Bind("yearEst") %>' style="z-index: 101; left: 115px; position: absolute; top: 44px" Width="50px"></asp:TextBox><br /> <asp:Label ID="employeeCountLabelName" runat="server" Text='No. of employees:' style="z-index: 101; left: 256px; position: absolute; top: 44px" Height="1px" Width="120px"></asp:Label> <asp:TextBox ID="employeeCountTextBox" runat="server" Text='<%# Bind("employeeCount") %>' style="z-index: 101; left: 380px; position: absolute; top: 44px" Width="40px"></asp:TextBox><br /> <asp:Label ID="Address_1LabelName" runat="server" Text='Address 1:' style="z-index: 102; left: 41px; position: absolute; top: 68px" Width="72px"></asp:Label> <asp:TextBox ID="Address_1TextBox" runat="server" Text='<%# Bind("Address_1") %>' style="z-index: 102; left: 115px; position: absolute; top: 68px" Width="600px"></asp:TextBox><br /> <asp:Label ID="Address_2LabelName" runat="server" Text='Address 2(opt.):' style="z-index: 103; left: 7px; position: absolute; top: 92px" Width="104px"></asp:Label> <asp:TextBox ID="Address_2TextBox" runat="server" Text='<%# Bind("Address_2") %>' style="z-index: 103; left: 115px; position: absolute; top: 92px" Width="600px"></asp:TextBox><br /> <asp:Label ID="ContactsLabelName" runat="server" Text='Contacts:' style="z-index: 104; left: 50px; position: absolute; top: 116px" Width="56px"></asp:Label> <asp:TextBox ID="ContactsTextBox" runat="server" Text='<%# Bind("Contacts") %>' style="z-index: 104; left: 115px; position: absolute; top: 116px" Width="600px"></asp:TextBox><br /> <asp:Label ID="TelNosLabelName" runat="server" Text='Telephone Nos.:' style="z-index: 106; left: 7px; position: absolute; top: 140px" Width="104px"></asp:Label> <asp:TextBox ID="TelNosTextBox" runat="server" Text='<%# Bind("TelNos") %>' style="z-index: 106; left: 115px; position: absolute; top: 140px" Width="600px"></asp:TextBox><br /> <asp:Label ID="FaxNosLabelName" runat="server" Text='Fax Nos.:' style="z-index: 107; left: 47px; position: absolute; top: 164px" Width="64px"></asp:Label> <asp:TextBox ID="FaxNosTextBox" runat="server" Text='<%# Bind("FaxNos") %>' style="z-index: 107; left: 115px; position: absolute; top: 164px" Width="600px"></asp:TextBox><br /> <asp:Label ID="emailAddressesLabelName" runat="server" Text='E-mal Address:' style="z-index: 108; left: 14px; position: absolute; top: 188px" Width="96px"></asp:Label> <asp:TextBox ID="emailAddressesTextBox" runat="server" Text='<%# Bind("emailAddresses") %>' style="z-index: 108; left: 115px; position: absolute; top: 188px" Width="600px"></asp:TextBox><br /> <asp:Label ID="WebsiteLabelName" runat="server" Text='Web Site:' style="z-index: 109; left: 48px; position: absolute; top: 212px" Width="64px"></asp:Label> <asp:TextBox ID="WebsiteTextBox" runat="server" Text='<%# Bind("Website") %>' style="z-index: 109; left: 115px; position: absolute; top: 212px" Width="600px"></asp:TextBox><br /> <asp:Label ID="CategoriesLabelName" runat="server" Text='Category:' style="z-index: 110; left: 48px; position: absolute; top: 236px" Width="56px"></asp:Label> <asp:TextBox ID="CategoriesTextBox" runat="server" Text='<%# Bind("Categories") %>' style="z-index: 110; left: 115px; position: absolute; top: 236px" Width="600px"></asp:TextBox><br /> <asp:Label ID="Sub_CategoriesLabelName" runat="server" Text='Sub-category:' style="z-index: 114; left: 22px; position: absolute; top: 260px" Width="88px"></asp:Label> <asp:TextBox ID="Sub_CategoriesTextBox" runat="server" Text='<%# Bind("Sub_Categories") %>' style="z-index: 114; left: 115px; position: absolute; top: 260px" Width="600px"></asp:TextBox><br /> <asp:Label ID="ServicesLabelName" runat="server" Text='Services:' style="z-index: 111; left: 53px; position: absolute; top: 284px" Width="56px"></asp:Label> <asp:TextBox ID="ServicesTextBox" runat="server" Text='<%# Bind("Services") %>' style="z-index: 111; left: 115px; position: absolute; top: 284px" Width="600px"></asp:TextBox><br /> <asp:Label ID="exportMarketsLabelName" runat="server" Text='Export Markets:' style="z-index: 119; left: 9px; position: absolute; top: 308px" Width="104px"></asp:Label> <asp:TextBox ID="exportMarketsTextBox" runat="server" Text='<%# Bind("exportMarkets") %>' style="z-index: 119; left: 115px; position: absolute; top: 308px" Width="600px"></asp:TextBox><br /> <asp:Label ID="ImportsLabelName" runat="server" Text='Imports:' style="z-index: 112; left: 56px; position: absolute; top: 332px" Width="48px"></asp:Label> <asp:TextBox ID="ImportsTextBox" runat="server" Text='<%# Bind("Imports") %>' style="z-index: 112; left: 115px; position: absolute; top: 332px" Width="600px"></asp:TextBox><br /> <asp:Label ID="importSourcesLabelName" runat="server" Text='Import Sources:' style="z-index: 115; left: 10px; position: absolute; top: 356px" Width="600px"></asp:Label> <asp:TextBox ID="importSourcesTextBox" runat="server" Text='<%# Bind("importSources") %>' style="z-index: 115; left: 115px; position: absolute; top: 356px" Width="600px"></asp:TextBox><br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" style="z-index: 115; left: 32px; position: absolute; top: 400px"> </asp:LinkButton> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" style="z-index: 115; left: 90px; position: absolute; top: 400px"> </asp:LinkButton> </EditItemTemplate> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> <InsertItemTemplate> Title: <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>'> </asp:TextBox><br /> yearEst: <asp:TextBox ID="yearEstTextBox" runat="server" Text='<%# Bind("yearEst") %>'> </asp:TextBox><br /> employeeCount: <asp:TextBox ID="employeeCountTextBox" runat="server" Text='<%# Bind("employeeCount") %>'> </asp:TextBox><br /> Address_1: <asp:TextBox ID="Address_1TextBox" runat="server" Text='<%# Bind("Address_1") %>'> </asp:TextBox><br /> Address_2: <asp:TextBox ID="Address_2TextBox" runat="server" Text='<%# Bind("Address_2") %>'> </asp:TextBox><br /> Contacts: <asp:TextBox ID="ContactsTextBox" runat="server" Text='<%# Bind("Contacts") %>'> </asp:TextBox><br /> TelNos: <asp:TextBox ID="TelNosTextBox" runat="server" Text='<%# Bind("TelNos") %>'> </asp:TextBox><br /> FaxNos: <asp:TextBox ID="FaxNosTextBox" runat="server" Text='<%# Bind("FaxNos") %>'> </asp:TextBox><br /> emailAddresses: <asp:TextBox ID="emailAddressesTextBox" runat="server" Text='<%# Bind("emailAddresses") %>'> </asp:TextBox><br /> Website: <asp:TextBox ID="WebsiteTextBox" runat="server" Text='<%# Bind("Website") %>'> </asp:TextBox><br /> Categories: <asp:TextBox ID="CategoriesTextBox" runat="server" Text='<%# Bind("Categories") %>'> </asp:TextBox><br /> Sub_Categories: <asp:TextBox ID="Sub_CategoriesTextBox" runat="server" Text='<%# Bind("Sub_Categories") %>'> </asp:TextBox><br /> Services: <asp:TextBox ID="ServicesTextBox" runat="server" Text='<%# Bind("Services") %>'> </asp:TextBox><br /> exportMarkets: <asp:TextBox ID="exportMarketsTextBox" runat="server" Text='<%# Bind("exportMarkets") %>'> </asp:TextBox><br /> Imports: <asp:TextBox ID="ImportsTextBox" runat="server" Text='<%# Bind("Imports") %>'> </asp:TextBox><br /> importSources: <asp:TextBox ID="importSourcesTextBox" runat="server" Text='<%# Bind("importSources") %>'> </asp:TextBox><br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert"> </asp:LinkButton> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="TitleLabelName" runat="server" Text='Company Name:' style="z-index: 100; left: 4px; position: absolute; top: 20px" Width="112px"></asp:Label> <asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' style="z-index: 100; left: 115px; position: absolute; top: 20px" Width="336px"></asp:Label> <asp:Label ID="Year_Est_LabelName" runat="server" Text='Established:' style="z-index: 101; left: 36px; position: absolute; top: 44px" Width="10px"></asp:Label> <asp:Label ID="Year_Est_Label" runat="server" Text='<%# Bind("[YearEst]") %>' style="z-index: 101; left: 115px; position: absolute; top: 44px"></asp:Label> <asp:Label ID="employeeCountLabelName" runat="server" Text='No. of employees:' style="z-index: 101; left: 256px; position: absolute; top: 44px" Height="1px" Width="120px"></asp:Label> <asp:Label ID="employeeCountLabel" runat="server" Text='<%# Bind("employeeCount") %>' style="z-index: 101; left: 380px; position: absolute; top: 44px" Height="1px" Width="1px"></asp:Label> <asp:Label ID="Address_1LabelName" runat="server" Text='Address 1:' style="z-index: 102; left: 41px; position: absolute; top: 68px" Width="72px"></asp:Label> <asp:Label ID="Address_1Label" runat="server" Text='<%# Bind("Address_1") %>' style="z-index: 102; left: 115px; position: absolute; top: 68px" Width="336px"></asp:Label> <asp:Label ID="Address_2LabelName" runat="server" Text='Address 2(opt.):' style="z-index: 103; left: 7px; position: absolute; top: 92px" Width="104px"></asp:Label> <asp:Label ID="Address_2Label" runat="server" Text='<%# Bind("Address_2") %>' style="z-index: 103; left: 115px; position: absolute; top: 92px" Width="528px"></asp:Label> <asp:Label ID="ContactsLabelName" runat="server" Text='Contacts:' style="z-index: 104; left: 50px; position: absolute; top: 116px" Width="56px"></asp:Label> <asp:Label ID="ContactsLabel" runat="server" Text='<%# Bind("Contacts") %>' style="z-index: 104; left: 115px; position: absolute; top: 116px" Width="528px"></asp:Label> <asp:Label ID="TelNosLabelName" runat="server" Text='Telephone Nos.:' style="z-index: 106; left: 7px; position: absolute; top: 140px" Width="104px"></asp:Label> <asp:Label ID="TelNosLabel" runat="server" Text='<%# Bind("TelNos") %>' style="z-index: 106; left: 115px; position: absolute; top: 140px" Width="536px"></asp:Label> <asp:Label ID="FaxNosLabelName" runat="server" Text='Fax Nos.:' style="z-index: 107; left: 47px; position: absolute; top: 164px" Width="64px"></asp:Label> <asp:Label ID="FaxNosLabel" runat="server" Text='<%# Bind("FaxNos") %>' style="z-index: 107; left: 115px; position: absolute; top: 164px" Width="536px"></asp:Label> <asp:Label ID="emailAddressesLabelName" runat="server" Text='E-mal Address:' style="z-index: 108; left: 14px; position: absolute; top: 188px" Width="96px"></asp:Label> <asp:Label ID="emailAddressesLabel" runat="server" Text='<%# Bind("emailAddresses") %>' style="z-index: 108; left: 115px; position: absolute; top: 188px" Width="536px"></asp:Label> <asp:Label ID="WebsiteLabelName" runat="server" Text='Web Site:' style="z-index: 109; left: 48px; position: absolute; top: 212px" Width="64px"></asp:Label> <asp:Label ID="WebsiteLabel" runat="server" Text='<%# Bind("Website") %>' style="z-index: 109; left: 115px; position: absolute; top: 212px" Width="536px"></asp:Label> <asp:Label ID="CategoriesLabelName" runat="server" Text='Category:' style="z-index: 110; left: 48px; position: absolute; top: 236px" Width="56px"></asp:Label> <asp:Label ID="CategoriesLabel" runat="server" Text='<%# Bind("Categories") %>' style="z-index: 110; left: 115px; position: absolute; top: 236px" Width="544px"></asp:Label> <asp:Label ID="Sub_CategoriesLabelName" runat="server" Text='Sub-category:' style="z-index: 114; left: 22px; position: absolute; top: 260px" Width="88px"></asp:Label> <asp:Label ID="Sub_CategoriesLabel" runat="server" Text='<%# Bind("Sub_Categories") %>' style="z-index: 114; left: 115px; position: absolute; top: 260px" Width="544px"></asp:Label> <asp:Label ID="ServicesLabelName" runat="server" Text='Services:' style="z-index: 111; left: 53px; position: absolute; top: 284px" Width="56px"></asp:Label> <asp:Label ID="ServicesLabel" runat="server" Text='<%# Bind("Services") %>' style="z-index: 111; left: 115px; position: absolute; top: 284px" Width="672px"></asp:Label> <asp:Label ID="exportMarketsLabelName" runat="server" Text='Export Markets:' style="z-index: 119; left: 9px; position: absolute; top: 308px" Width="104px"></asp:Label> <asp:Label ID="exportMarketsLabel" runat="server" Text='<%# Bind("exportMarkets") %>' style="z-index: 119; left: 115px; position: absolute; top: 308px" Width="544px"></asp:Label> <asp:Label ID="ImportsLabelName" runat="server" Text='Imports:' style="z-index: 112; left: 56px; position: absolute; top: 332px" Width="48px"></asp:Label> <asp:Label ID="ImportsLabel" runat="server" Text='<%# Bind("Imports") %>' style="z-index: 112; left: 115px; position: absolute; top: 332px" Width="664px"></asp:Label> <asp:Label ID="importSourcesLabelName" runat="server" Text='Import Sources:' style="z-index: 115; left: 10px; position: absolute; top: 356px" Width="544px"></asp:Label> <asp:Label ID="importSourcesLabel" runat="server" Text='<%# Bind("importSources") %>' style="z-index: 115; left: 115px; position: absolute; top: 356px" Width="544px"></asp:Label> <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" style="z-index: 117; left: 32px; position: absolute; top: 400px"></asp:LinkButton> </ItemTemplate> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> </asp:FormView> </div> </form></body></html> |
|