开发者

gridview edit not updating, even though there are no errors

For some reason, when i click edit on my gridview and change a value, and hit update, it does not update the database or the gridview, and it shows no error

   <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id"
                        DataSourceID="SqlDataSource1" OnRowDataBound="GridView1_RowDataBound" AllowSorting="True" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" ShowFooter="True" style="font-size: 10pt">
                        <Columns>
                            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                            <asp:BoundField DataField="memberid" HeaderText="Member ID" SortExpression="memberid" />
                            <asp:TemplateField HeaderText="Guests" SortExpression="Guests">
                            <ItemTemplate>
 <%#Getguesttotal(Decimal.Parse(Eval("guests").ToString()))%>
</ItemTemplate>
<FooterTemplate>
<%#Getguesttotal1()%>
</FooterTemplate>
    <FooterStyle Font-Bold="True" />
</asp:TemplateField>
                            <asp:BoundField DataField="firstname" HeaderText="First Name" SortExpression="firstname" />
                            <asp:BoundField DataField="lastname" HeaderText="Last Name" SortExpression="lastname" />
                            <asp:BoundField DataField="dob" HeaderText="DOB" SortExpression="dob" />
                            <asp:BoundField DataField="idnumber" HeaderText="ID #" SortExpression="idnumber" />
                            <asp:BoundField DataField="countryissued" HeaderText="Country Issued" SortExpression="countryissued" />
                            <asp:BoundField DataField="emailaddress" HeaderText="Email" SortExpression="emailaddress" />
                            <asp:BoundField DataField="firstname2" HeaderText="First Name 2" SortExpression="firstname2" />
                            <asp:BoundField DataField="lastname2" HeaderText="Last Name 2" SortExpression="lastname2" />
                            <asp:BoundField DataField="dob2" HeaderText="DOB 2" SortExpression="dob2" />
                            <asp:BoundField DataField="idnumber2" HeaderText="ID # 2" SortExpression="idnumber2" />
                            <asp:BoundField DataField="countryissued2" HeaderText="Country Issued 2" SortExpression="countryissued2" />
                            <asp:BoundField DataField="emailaddress2" HeaderText="Email 2" SortExpression="emailaddress2" />
                            <asp:BoundField DataField="lasttravel" HeaderText="Last Travel" SortExpression="lasttravel" />
                            <asp:BoundField DataField="traveltype" HeaderText="Travel Type" SortExpression="traveltype" />
                            <asp:BoundField DataField="status" HeaderText="Status" SortExpression="status" />
                            <asp:BoundField DataField="phonenumber" HeaderText="Phone Number" SortExpression="phonenumber" />
                            <asp:BoundField DataField="now" HeaderText="Time Registered" SortExpression="now" />
                            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True"
                                SortExpression="id" Visible="False" />
                            <asp:BoundField DataField="event" HeaderText="EventString" SortExpression="event" />
                            <asp:BoundField DataField="Guests" HeaderText="Guests" />


                        </Columns>
                        <RowStyle BackColor="#F7F7DE" />
                        <FooterStyle BackColor="#CCCC99" />
                        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>   

    SelectCommand="SELECT memberid, firstname, lastname, dob, idnumber, countryissued, emailaddress, firstname2, lastname2, dob2, idnumber2, countryissued2, emailaddress2, lasttravel, phonenumber, guests, now, event, status, id, traveltype FROM eventregistration WHERE (event = @event)" ConflictDetection="CompareAllValues" 

            DeleteCommand="DELETE FROM [eventregistration] WHERE [id] = @original_id AND (([memberid] = @original_memberid) OR ([memberid] IS NULL AND @original_memberid IS NULL)) AND (([firstname] = @original_firstname) OR ([firstname] IS NULL AND @original_firstname IS NULL)) AND (([lastname] = @original_lastname) OR ([lastname] IS NULL AND @original_lastname IS NULL)) AND (([dob] = @original_dob) OR ([dob] IS NULL AND @original_dob IS NULL)) AND (([idnumber] = @original_idnumber) OR ([idnumber] IS NULL AND @original_idnumber IS NULL)) AND (([countryissued] = @original_countryissued) OR ([countryissued] IS NULL AND @original_countryissued IS NULL)) AND (([emailaddress] = @original_emailaddress) OR ([emailaddress] IS NULL AND @original_emailaddress IS NULL)) AND (([firstname2] = @original_firstname2) OR ([firstname2] IS NULL AND @original_firstname2 IS NULL)) AND (([lastname2] = @original_lastname2) OR ([lastname2] IS NULL AND @original_lastname2 IS NULL)) AND (([dob2] = @original_dob2) OR ([dob2] IS NULL AND @original_dob2 IS NULL)) AND (([idnumber2] = @original_idnumber2) OR ([idnumber2] IS NULL AND @original_idnumber2 IS NULL)) AND (([countryissued2] = @original_countryissued2) OR ([countryissued2] IS NULL AND @original_countryissued2 IS NULL)) AND (([emailaddress2] = @original_emailaddress2) OR ([emailaddress2] IS NULL AND @original_emailaddress2 IS NULL)) AND (([lasttravel] = @original_lasttravel) OR ([lasttravel] IS NULL AND @original_lasttravel IS NULL)) AND (([phonenumber] = @original_phonenumber) OR ([phonenumber] IS NULL AND @original_phonenumber IS NULL)) AND (([guests] = @original_guests) OR ([guests] IS NULL AND @original_guests IS NULL)) AND (([now] = @original_now) OR ([now] IS NULL AND @original_now IS NULL)) AND (([event] = @original_event) OR ([event] IS NULL AND @original_event IS NULL)) AND (([status] = @original_status) OR ([status] IS NULL AND @original_status IS NULL)) AND (([traveltype] = @original_traveltype) OR ([traveltype] IS NULL AND @original_traveltype IS NULL))" 

            InsertCommand="INSERT INTO [eventregistration] ([memberid], [firstname], [lastname], [dob], [idnumber], [countryissued], [emailaddress], [firstname2], [lastname2], [dob2], [idnumber2], [countryissued2], [emailaddress2], [lasttravel], [phonenumber], [guests], [now], [event], [status], [traveltype]) 
        VALUES (@memberid, @firstname, @lastname, @dob, @idnumber, @countryissued, @emailaddress, @firstname2, @lastname2, @dob2, @idnumber2, @countryissued2, @emailaddress2, @lasttravel, @phonenumber, @guests, @now, @event, @status, @traveltype)" OldValuesParameterFormatString="original_{0}" 

            UpdateCommand="UPDATE [eventregistration] SET [memberid] = @memberid, [firstname] = @firstname, [lastname] = @lastname, [dob] = @dob, [idnumber] = @idnumber, [countryissued] = @countryissued, [emailaddress] = @emailaddress, [firstname2] = @firstname2, [lastname2] = @lastname2, [dob2] = @dob2, [idnumber2] = @idnumber2, [countryissued2] = @countryissued2, [emailaddress2] = @emailaddress2, [lasttravel] = @lasttravel, [phonenumber] = @phonenumber, [guests] = @guests, [now] = @now, [event] = @event, [status] = @status, [traveltype] = @traveltype
        WHERE [id] = @original_id AND (([memberid] = @original_memberid) OR ([memberid] IS NULL AND @original_memberid IS NULL)) AND (([firstname] = @original_firstname) OR ([firstname] IS NULL AND @original_firstname IS NULL)) AND (([lastname] = @original_lastname) OR ([lastname] IS NULL AND @original_lastname IS NULL)) AND (([dob] = @original_dob) OR ([dob] IS NULL AND @original_dob IS NULL)) AND (([idnumber] = @original_idnumber) OR ([idnumber] IS NULL AND @original_idnumber IS NULL)) AND (([countryissued] = @original_countryissued) OR ([countryissued] IS NULL AND @original_countryissued IS NULL)) AND (([emailaddress] = @original_emailaddress) OR ([emailaddress] IS NULL AND @original_emailaddress IS NULL)) AND (([firstname2] = @original_firstname2) OR ([firstname2] IS NULL AND @original_firstname2 IS NULL)) AND (([lastname2] = @original_lastname2) OR ([lastname2] IS NULL AND @original_lastname2 IS NULL)) AND (([dob2] = @original_dob2) OR ([dob2] IS NULL AND @original_dob2 IS NULL)) AND (([idnumber2] = @original_idnumber2) OR ([idnumber2] IS NULL AND @original_idnumber2 IS NULL)) AND (([countryissued2] = @original_countryissued2) OR ([countryissued2] IS NULL AND @original_countryissued2 IS NULL)) AND (([emailaddress2] = @original_emailaddress2) OR ([emailaddress2] IS NULL AND @original_emailaddress2 IS NULL)) AND (([lasttravel] = @original_lasttravel) OR ([lasttravel] IS NULL AND @original_lasttravel IS NULL)) AND (([phonenumber] = @original_phonenumber) OR ([phonenumber] IS NULL AND @original_phonenumber IS NULL)) AND (([guests] = @original_guests) OR ([guests] IS NULL AND @original_guests IS NULL)) AND (([now] = @original_now) OR ([now] IS NULL AND @original_now IS NULL)) AND (([event] = @original_event) OR ([event] IS NULL AND @original_event IS NULL)) AND (([status] = @original_status) OR ([status] IS NULL AND @original_status IS NULL)) AND (([traveltype] = @original_traveltype) OR ([traveltype] IS NULL AND @original_traveltype IS NULL))">

                    <UpdateParameters>
                                                <asp:Parameter Name="memberid" Type="String" />
                                                <asp:Parameter Name="firstname" Type="String" />
                                                <asp:Parameter Name="lastname" Type="String" />
                                                <asp:Parameter Name="dob" Type="String" />
                                                <asp:Parameter Name="idnumber" Type="String" />
                                                <asp:Parameter Name="countryissued" Type="String" />
                                                <asp:Parameter Name="emailaddress" Type="String" />
                                                <asp:Parameter Name="firstname2" Type="String" />
                                                <asp:Parameter Name="lastname2" Type="String" />
                                                <asp:Parameter Name="dob2" Type="String" />
                                                <asp:Parameter Name="idnumber2" Type="String" />
                                                <asp:Parameter Name="countryissued2" Type="String" />
                                                <asp:Parameter Name="emailaddress2" Type="String" />
                                                <asp:Parameter Name="lasttravel" Type="String" />
                                                <asp:Paramet开发者_JAVA技巧er Name="phonenumber" Type="String" />
                                                <asp:Parameter Name="guests" Type="Int32" />
                                                <asp:Parameter DbType="DateTime" Name="now" />
                                                <asp:Parameter Name="event" Type="String" />
                                                <asp:Parameter Name="status" Type="String" />
                                                <asp:Parameter Name="traveltype" Type="String" />
                                                <asp:Parameter Name="original_id" Type="Int32" />
                                                <asp:Parameter Name="original_memberid" Type="String" />
                                                <asp:Parameter Name="original_firstname" Type="String" />
                                                <asp:Parameter Name="original_lastname" Type="String" />
                                                <asp:Parameter Name="original_dob" Type="String" />
                                                <asp:Parameter Name="original_idnumber" Type="String" />
                                                <asp:Parameter Name="original_countryissued" Type="String" />
                                                <asp:Parameter Name="original_emailaddress" Type="String" />
                                                <asp:Parameter Name="original_firstname2" Type="String" />
                                                <asp:Parameter Name="original_lastname2" Type="String" />
                                                <asp:Parameter Name="original_dob2" Type="String" />
                                                <asp:Parameter Name="original_idnumber2" Type="String" />
                                                <asp:Parameter Name="original_countryissued2" Type="String" />
                                                <asp:Parameter Name="original_emailaddress2" Type="String" />
                                                <asp:Parameter Name="original_lasttravel" Type="String" />
                                                <asp:Parameter Name="original_phonenumber" Type="String" />
                                                <asp:Parameter Name="original_guests" Type="Int32" />
                                                <asp:Parameter DbType="DateTime" Name="original_now" />
                                                <asp:Parameter Name="original_event" Type="String" />
                                                <asp:Parameter Name="original_status" Type="String" />
                                                <asp:Parameter Name="original_traveltype" Type="String" />
                                            </UpdateParameters>


One of the fields in your enormous update....WHERE clause is causing no records to be selected so no records are being updated.

This may help

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜