SQL Server 存储过程更新不适用于 ASP.Net C# GridView RowUpdating

2024-06-30

我遇到了问题,但没有抛出任何错误。发生的情况是,我有一个存储过程正在驱动我的更新,但我无法更新 gridview。

我击中了Update链接按钮,但它实际上并没有更新记录。

这是我的存储过程:

ALTER PROCEDURE [dbo].[CompDev_Update](
@CompID int,
@NewDevCount nchar(10) = null,
@DevelopmentName nvarchar(255) = null,
@City nvarchar(255) = null,
@State nvarchar(255) = null,
@ZipCodeofNewDev nchar(10) = null,
@ProjectStatus nvarchar(255) = null,
@ShoppingCenter nvarchar(255) = null,
@ProjectStartDate float = null,
@ProjectDescription nvarchar(255) = null,
@ProposedAnchorTenants nvarchar(255) = null,
@GLA nchar(10) = null,
@EstCompDate float = null,
@Developer nvarchar(255) = null,
@BusinessUnit nchar(10) = null,
@BU nchar(10) = null,
@CenterName nvarchar(255) = null,
@MSA nvarchar(255) = null,
@BrixmorMSARank nchar(10) = null,
@Count nchar(10) = null,
@Region nvarchar(255) = null,
@DistancefromNewDev nchar(10) = null
)
   AS
   BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
UPDATE WestCompetition Set NewDevCount=@NewDevCount, DevelopmentName=@DevelopmentName,
    City=@City, [State]=@State, ZipCodeofNewDev=@ZipCodeofNewDev, ProjectStatus=@ProjectStatus,
    ShoppingCenter=@ShoppingCenter, ProjectStartDate=@ProjectStartDate, ProjectDescription=@ProjectDescription,
    ProposedAnchorTenants=@ProposedAnchorTenants, GLA=@GLA, EstCompDate=@EstCompDate,
    Developer=@Developer, BusinessUnit=@BusinessUnit, BU=@BU, CenterName=@CenterName,
    MSA=@MSA, BrixmorMSARank=@BrixmorMSARank, [Count]=@Count, Region=@Region,
    DistancefromNewDev=@DistancefromNewDev
    WHERE CompID = @CompID

END

这是我的 asp.net c# 背后的代码:

 protected void gvCompetition_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label CompID = (Label)gvCompetition.Rows[e.RowIndex].FindControl("lblCompID");
        TextBox NewDevCount = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtNewDevCount");
        TextBox DevelopmentName = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtDevelopmentName");
        TextBox City = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtCity");
        TextBox State = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtState");
        TextBox ZipCodeofNewDev = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtZipCode");
        TextBox ProjectStatus = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtProjectStatus");
        TextBox ShoppingCenter = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtShoppingCenter");
        TextBox ProjectStartDate = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtProjectStartDate");
        TextBox ProjectDescription = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtProjectDescription");
        TextBox ProposedAnchorTenants = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtProposedAnchorTenants");
        TextBox GLA = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtGLA");
        TextBox EstCompDate = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtEstCompDate");
        TextBox Developer = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtDeveloper");
        TextBox BusinessUnit = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtBusinessUnit");
        TextBox BU = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtBU");
        TextBox CenterName = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtCenterName");
        TextBox MSA = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtMSA");
        TextBox BrixmorMSARank = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtBrixmorMSARank");
        TextBox Count = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtCount");
        TextBox Region = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtRegion");
        TextBox DistancefromNewDev = (TextBox)gvCompetition.Rows[e.RowIndex].FindControl("txtDistancefromNewDev");
        string ecompid = CompID.Text;
        string enewdevcount = NewDevCount.Text;
        string edevelopmentname = DevelopmentName.Text;
        string ecity = City.Text;
        string estate = State.Text;
        string ezipcode = ZipCodeofNewDev.Text;
        string eprojectstatus = ProjectStatus.Text;
        string eshoppingcenter = ShoppingCenter.Text;
        string eprojectstartdate = ProjectStartDate.Text;
        string eprojectdescription = ProjectDescription.Text;
        string eproposedanchor = ProposedAnchorTenants.Text;
        string egla = GLA.Text;
        string eestcompdate = EstCompDate.Text;
        string edeveloper = Developer.Text;
        string ebusinessunit = BusinessUnit.Text;
        string ebu = BU.Text;
        string ecentername = CenterName.Text;
        string emsa = MSA.Text;
        string ebrixmormsarank = BrixmorMSARank.Text;
        string ecount = Count.Text;
        string eregion = Region.Text;
        string edistancefromnewdev = DistancefromNewDev.Text;

        UpdateCompetition(ecompid, enewdevcount, edevelopmentname, ecity, estate, ezipcode, eprojectstatus, eshoppingcenter, eprojectstartdate, eprojectdescription, eproposedanchor,
            egla, eestcompdate, edeveloper, ebusinessunit, ebu, ecentername, emsa, ebrixmormsarank, ecount, eregion, edistancefromnewdev);

        gvCompetition.EditIndex = -1;
        BindCompetition();
    }

    protected void UpdateCompetition(string compid, string newdevcount, string developmentname, string city, string state, string zipcode,
        string projectstatus, string shoppingcenter, string projectstartdate, string projectdescription, string proposedanchor, string gla,
        string estcompdate, string developer, string businessunit, string bu, string centername, string msa, string brixmormsarank,
        string count, string region, string distancefromnewdev)
    {
        SqlConnection conn = new SqlConnection(cnnString);
        conn.Open();
        command = new SqlCommand();
        command.Connection = conn;
        command.CommandType = CommandType.StoredProcedure;
        command.CommandText = "CompDev_Update";

        command.Parameters.Add(new SqlParameter("@CompID", SqlDbType.Int));
        command.Parameters.Add(new SqlParameter("@NewDevCount", SqlDbType.NChar, 10));
        command.Parameters.Add(new SqlParameter("@DevelopmentName", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@City", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@ZipCodeofNewDev", SqlDbType.NChar, 10));
        command.Parameters.Add(new SqlParameter("@ProjectStatus", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@ShoppingCenter", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@ProjectStartDate", SqlDbType.Float));
        command.Parameters.Add(new SqlParameter("@ProjectDescription", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@ProposedAnchorTenants", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@GLA", SqlDbType.NChar, 10));
        command.Parameters.Add(new SqlParameter("@EstCompDate", SqlDbType.Float));
        command.Parameters.Add(new SqlParameter("@Developer", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@BusinessUnit", SqlDbType.NChar, 10));
        command.Parameters.Add(new SqlParameter("@BU", SqlDbType.NChar, 10));
        command.Parameters.Add(new SqlParameter("@CenterName", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@MSA", SqlDbType.NChar, 10));
        command.Parameters.Add(new SqlParameter("@BrixmorMSARank", SqlDbType.NChar, 10));
        command.Parameters.Add(new SqlParameter("@Count", SqlDbType.NChar, 10));
        command.Parameters.Add(new SqlParameter("@Region", SqlDbType.NVarChar, 255));
        command.Parameters.Add(new SqlParameter("@DistancefromNewDev", SqlDbType.NChar, 10));

        command.Parameters["@CompID"].Value = Convert.ToInt32(compid.ToString());
        command.Parameters["@NewDevCount"].Value = newdevcount;
        command.Parameters["@DevelopmentName"].Value = developmentname;
        command.Parameters["@City"].Value = city;
        command.Parameters["@State"].Value = state;
        command.Parameters["@ZipCodeofNewDev"].Value = zipcode;
        command.Parameters["@ProjectStatus"].Value = projectstatus;
        command.Parameters["@ShoppingCenter"].Value = shoppingcenter;
        command.Parameters["@ProjectStartDate"].Value = projectstartdate;
        command.Parameters["@ProjectDescription"].Value = projectdescription;
        command.Parameters["@ProposedAnchorTenants"].Value = proposedanchor;
        command.Parameters["@GLA"].Value = gla;
        command.Parameters["@EstCompDate"].Value = estcompdate;
        command.Parameters["@Developer"].Value = developer;
        command.Parameters["@BusinessUnit"].Value = businessunit;
        command.Parameters["@BU"].Value = bu;
        command.Parameters["@CenterName"].Value = centername;
        command.Parameters["@MSA"].Value = msa;
        command.Parameters["@BrixmorMSARank"].Value = brixmormsarank;
        command.Parameters["@Count"].Value = count;
        command.Parameters["@Region"].Value = region;
        command.Parameters["@DistancefromNewDev"].Value = distancefromnewdev;

        da = new SqlDataAdapter(command);
        ds = new DataSet();
        da.Fill(ds);

        conn.Close();
    }

这是我的 ASP.NET 代码:

<asp:UpdatePanel runat="server" UpdateMode="Conditional">
    <ContentTemplate>
            <asp:GridView ID="gvCompetition" OnPageIndexChanging="gvCompetition_PageIndexChanging" 
                OnRowEditing="gvCompetition_RowEditing" OnRowCancelingEdit="gvCompetition_RowCancelingEdit"
                OnRowUpdating="gvCompetition_RowUpdating"
                runat="server" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" 
                BorderWidth="1px" CellPadding="1" ForeColor="Black" GridLines="Vertical" 
                AllowPaging="True" AutoGenerateColumns="False" Font-Size="10px">
                <AlternatingRowStyle BackColor="White" />
                <FooterStyle BackColor="#CCCC99" />
                <HeaderStyle BackColor="#7a1501" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#ed2d22" ForeColor="Black" HorizontalAlign="Right" />
                <RowStyle BackColor="#f68121" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" />
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#FBFBF2" />
                <SortedAscendingHeaderStyle BackColor="#848384" />
                <SortedDescendingCellStyle BackColor="#EAEAD3" />
                <SortedDescendingHeaderStyle BackColor="#575357" />
                <Columns>
                    <asp:templatefield Headertext="ID">
                        <itemtemplate>
                            <asp:label ID="lblCompID" runat="server" text='<%#Eval("CompID") %>'></asp:label>
                        </itemtemplate>
                    </asp:templatefield>

                    <asp:TemplateField HeaderText="New Dev Count">
                        <ItemTemplate>
                            <asp:Label ID="lblNewDevCount" runat="server" Text='<%#Eval("NewDevCount") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtNewDevCount" Width="100%" runat="server" Text='<%#Eval("NewDevCount") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Development Name">
                        <ItemTemplate>
                            <asp:Label ID="lblDevelopmentName" runat="server" Text='<%#Eval("DevelopmentName") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDevelopmentName" Width="100%" runat="server" Text='<%#Eval("DevelopmentName") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="City">
                        <ItemTemplate>
                            <asp:Label ID="lblCity" runat="server" Text='<%#Eval("City") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtCity" Width="100%" runat="server" Text='<%#Eval("City") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="State">
                        <ItemTemplate>
                            <asp:Label ID="lblState" runat="server" Text='<%#Eval("State") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtState" Width="100%" runat="server" Text='<%#Eval("State") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Zip Code">
                        <ItemTemplate>
                            <asp:Label ID="lblZipCode" runat="server" Text='<%#Eval("ZipCodeofNewDev") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtZipCode" Width="100%" runat="server" Text='<%#Eval("ZipCodeofNewDev") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Project Status">
                        <ItemTemplate>
                            <asp:Label ID="lblProjectStatus" runat="server" Text='<%#Eval("ProjectStatus") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtProjectStatus" Width="100%" runat="server" Text='<%#Eval("ProjectStatus") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Shopping Center">
                        <ItemTemplate>
                            <asp:Label ID="lblShoppingCenter" runat="server" Text='<%#Eval("ShoppingCenter") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtShoppingCenter" Width="100%" runat="server" Text='<%#Eval("ShoppingCenter") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Project Start Date">
                        <ItemTemplate>
                            <asp:Label ID="lblProjectStartDate" runat="server" Text='<%#Eval("ProjectStartDate") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtProjectStartDate" Width="100%" runat="server" Text='<%#Eval("ProjectStartDate") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Project Description">
                        <ItemTemplate>
                            <asp:Label ID="lblProjectDescription" runat="server" Text='<%#Eval("ProjectDescription") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtProjectDescription" Width="100%" runat="server" Text='<%#Eval("ProjectDescription") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Proposed Anchor Tenants">
                        <ItemTemplate>
                            <asp:Label ID="lblProposedAnchorTenants" runat="server" Text='<%#Eval("ProposedAnchorTenants") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtProposedAnchorTenants" Width="100%" runat="server" Text='<%#Eval("ProposedAnchorTenants") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="GLA">
                        <ItemTemplate>
                            <asp:Label ID="lblGLA" runat="server" Text='<%#Eval("GLA") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtGLA" Width="100%" runat="server" Text='<%#Eval("GLA") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Est. Completion Date">
                        <ItemTemplate>
                            <asp:Label ID="lblEstCompDate" runat="server" Text='<%#Eval("EstCompDate") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtEstCompDate" Width="100%" runat="server" Text='<%#Eval("EstCompDate") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Developer">
                        <ItemTemplate>
                            <asp:Label ID="lblDeveloper" runat="server" Text='<%#Eval("Developer") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDeveloper" Width="100%" runat="server" Text='<%#Eval("Developer") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Business Unit">
                        <ItemTemplate>
                            <asp:Label ID="lblBusinessUnit" runat="server" Text='<%#Eval("BusinessUnit") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtBusinessUnit" Width="100%" runat="server" Text='<%#Eval("BusinessUnit") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="BU">
                        <ItemTemplate>
                            <asp:Label ID="lblBU" runat="server" Text='<%#Eval("BU") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtBU" Width="100%" runat="server" Text='<%#Eval("BU") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="CenterName">
                        <ItemTemplate>
                            <asp:Label ID="lblCenterName" runat="server" Text='<%#Eval("CenterName") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtCenterName" Width="100%" runat="server" Text='<%#Eval("CenterName") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="MSA">
                        <ItemTemplate>
                            <asp:Label ID="lblMSA" runat="server" Text='<%#Eval("MSA") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtMSA" Width="100%" runat="server" Text='<%#Eval("MSA") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Brixmor MSA Rank">
                        <ItemTemplate>
                            <asp:Label ID="lblBrixmorMSARank" runat="server" Text='<%#Eval("BrixmorMSARank") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtBrixmorMSARank" Width="100%" runat="server" Text='<%#Eval("BrixmorMSARank") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Count">
                        <ItemTemplate>
                            <asp:Label ID="lblCount" runat="server" Text='<%#Eval("Count") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtCount" Width="100%" runat="server" Text='<%#Eval("Count") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Region">
                        <ItemTemplate>
                            <asp:Label ID="lblRegion" runat="server" Text='<%#Eval("Region") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtRegion" Width="100%" runat="server" Text='<%#Eval("Region") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Distance from New Dev">
                        <ItemTemplate>
                            <asp:Label ID="lblDistancefromNewDev" runat="server" Text='<%#Eval("DistancefromNewDev") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDistancefromNewDev" Width="100%" runat="server" Text='<%#Eval("DistancefromNewDev") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>


                    <asp:TemplateField HeaderText="Edit">
                        <ItemTemplate>
                            <asp:LinkButton ID="btnEdit" Text="EDIT" runat="server" CommandName="Edit" />

                            <span onclick="return confirm('Are you sure you want to delete this record')">
                                <asp:LinkButton ID="btnDelete" Text="DELETE" runat="server" CommandName="Delete" />
                            </span>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:LinkButton ID="btnUpdate" Text="UPDATE" runat="server" CommandName="Update" />
                            <br />
                            <asp:LinkButton ID="btnCancel" Text="CANCEL" runat="server" CommandName="Cancel" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="gvCompetition" EventName="PageIndexChanging" />
        <asp:AsyncPostBackTrigger ControlID="gvCompetition" EventName="RowEditing" />
        <asp:AsyncPostBackTrigger ControlID="gvCompetition" EventName="RowUpdating" />
        <asp:AsyncPostBackTrigger ControlID="gvCompetition" EventName="RowCancelingEdit" />
    </Triggers>
</asp:UpdatePanel>

我做错了什么导致更新不会发生?为什么我在不更新时没有抛出任何错误?


存储过程:

ALTER PROCEDURE [dbo].[CompDev_Select]
AS
    BEGIN
        SET NOCOUNT ON;

        SELECT  [WC].[CompID]
              , [WC].[NewDevCount]
              , [WC].[DevelopmentName]
              , [WC].[City]
              , [WC].[State]
              , [WC].[ZipCodeofNewDev]
              , [WC].[ProjectStatus]
              , [WC].[ShoppingCenter]
              , [WC].[ProjectStartDate]
              , [WC].[ProjectDescription]
              , [WC].[ProposedAnchorTenants]
              , [WC].[GLA]
              , [WC].[EstCompDate]
              , [WC].[Developer]
              , [WC].[BusinessUnit]
              , [WC].[BU]
              , [WC].[CenterName]
              , [WC].[MSA]
              , [WC].[BrixmorMSARank]
              , [WC].[Count]
              , [WC].[Region]
              , [WC].[DistancefromNewDev]
        FROM    [dbo].[WestCompetition] AS WC

        SET NOCOUNT OFF;
    END
GO



ALTER PROCEDURE [dbo].[CompDev_Update]
    ( @CompID INT
    , @NewDevCount NCHAR(10) = NULL
    , @DevelopmentName NVARCHAR(255) = NULL
    , @City NVARCHAR(255) = NULL
    , @State NVARCHAR(255) = NULL
    , @ZipCodeofNewDev NCHAR(10) = NULL
    , @ProjectStatus NVARCHAR(255) = NULL
    , @ShoppingCenter NVARCHAR(255) = NULL
    , @ProjectStartDate FLOAT = NULL
    , @ProjectDescription NVARCHAR(255) = NULL
    , @ProposedAnchorTenants NVARCHAR(255) = NULL
    , @GLA NCHAR(10) = NULL
    , @EstCompDate FLOAT = NULL
    , @Developer NVARCHAR(255) = NULL
    , @BusinessUnit NCHAR(10) = NULL
    , @BU NCHAR(10) = NULL
    , @CenterName NVARCHAR(255) = NULL
    , @MSA NVARCHAR(255) = NULL
    , @BrixmorMSARank NCHAR(10) = NULL
    , @Count NCHAR(10) = NULL
    , @Region NVARCHAR(255) = NULL
    , @DistancefromNewDev NCHAR(10) = NULL )
AS
    BEGIN
        SET NOCOUNT ON;

        UPDATE  WC
        SET     NewDevCount = @NewDevCount
              , DevelopmentName = @DevelopmentName
              , City = @City
              , [State] = @State
              , ZipCodeofNewDev = @ZipCodeofNewDev
              , ProjectStatus = @ProjectStatus
              , ShoppingCenter = @ShoppingCenter
              , ProjectStartDate = @ProjectStartDate
              , ProjectDescription = @ProjectDescription
              , ProposedAnchorTenants = @ProposedAnchorTenants
              , GLA = @GLA
              , EstCompDate = @EstCompDate
              , Developer = @Developer
              , BusinessUnit = @BusinessUnit
              , BU = @BU
              , CenterName = @CenterName
              , MSA = @MSA
              , BrixmorMSARank = @BrixmorMSARank
              , [Count] = @Count
              , Region = @Region
              , DistancefromNewDev = @DistancefromNewDev
        FROM    [dbo].[WestCompetition] AS WC
        WHERE   ( [WC].CompID = @CompID );

        SET NOCOUNT OFF;
    END
GO


ALTER PROCEDURE [dbo].[CompDev_Insert]
    ( @NewDevCount NCHAR(10) = NULL
    , @DevelopmentName NVARCHAR(255) = NULL
    , @City NVARCHAR(255) = NULL
    , @State NVARCHAR(255) = NULL
    , @ZipCodeofNewDev NCHAR(10) = NULL
    , @ProjectStatus NVARCHAR(255) = NULL
    , @ShoppingCenter NVARCHAR(255) = NULL
    , @ProjectStartDate FLOAT = NULL
    , @ProjectDescription NVARCHAR(255) = NULL
    , @ProposedAnchorTenants NVARCHAR(255) = NULL
    , @GLA NCHAR(10) = NULL
    , @EstCompDate FLOAT = NULL
    , @Developer NVARCHAR(255) = NULL
    , @BusinessUnit NCHAR(10) = NULL
    , @BU NCHAR(10) = NULL
    , @CenterName NVARCHAR(255) = NULL
    , @MSA NVARCHAR(255) = NULL
    , @BrixmorMSARank NCHAR(10) = NULL
    , @Count NCHAR(10) = NULL
    , @Region NVARCHAR(255) = NULL
    , @DistancefromNewDev NCHAR(10) = NULL )
AS
    INSERT  INTO [dbo].[WestCompetition]
            ( [NewDevCount]
            , [DevelopmentName]
            , [City]
            , [State]
            , [ZipCodeofNewDev]
            , [ProjectStatus]
            , [ShoppingCenter]
            , [ProjectStartDate]
            , [ProjectDescription]
            , [ProposedAnchorTenants]
            , [GLA]
            , [EstCompDate]
            , [Developer]
            , [BusinessUnit]
            , [BU]
            , [CenterName]
            , [MSA]
            , [BrixmorMSARank]
            , [Count]
            , [Region]
            , [DistancefromNewDev] )
    VALUES  ( @NewDevCount
            , @DevelopmentName
            , @City
            , @State
            , @ZipCodeofNewDev
            , @ProjectStatus
            , @ShoppingCenter
            , @ProjectStartDate
            , @ProjectDescription
            , @ProposedAnchorTenants
            , @GLA
            , @EstCompDate
            , @Developer
            , @BusinessUnit
            , @BU
            , @CenterName
            , @MSA
            , @BrixmorMSARank
            , @Count
            , @Region
            , @DistancefromNewDev );
GO


ALTER PROCEDURE [dbo].[CompDev_Delete] ( @CompID INT )
AS
    BEGIN
        SET NOCOUNT ON;

        DELETE  WC
        FROM    [dbo].[WestCompetition] AS WC
        WHERE   [WC].[CompID] = @CompID

        SET NOCOUNT OFF;
    END
GO

前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:ListView ID="ListView1" runat="server" DataKeyNames="CompID" DataSourceID="SqlDataSource1" InsertItemPosition="LastItem">
                        <ItemTemplate>
                            <tr style="background-color: rgba(246, 129, 33, 1); border: 1px solid rgba(153, 153, 153, 1);">
                                <td><asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" /></td>
                                <td><asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" /></td>
                                <td><asp:Label ID="CompIDLabel" runat="server" Text='<%# Eval("CompID") %>' /></td>
                                <td><asp:Label ID="NewDevCountLabel" runat="server" Text='<%# Eval("NewDevCount") %>' /></td>
                                <td><asp:Label ID="DevelopmentNameLabel" runat="server" Text='<%# Eval("DevelopmentName") %>' /></td>
                                <td><asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' /></td>
                                <td><asp:Label ID="StateLabel" runat="server" Text='<%# Eval("State") %>' /></td>
                                <td><asp:Label ID="ZipCodeofNewDevLabel" runat="server" Text='<%# Eval("ZipCodeofNewDev") %>' /></td>
                                <td><asp:Label ID="ProjectStatusLabel" runat="server" Text='<%# Eval("ProjectStatus") %>' /></td>
                                <td><asp:Label ID="ShoppingCenterLabel" runat="server" Text='<%# Eval("ShoppingCenter") %>' /></td>
                                <td><asp:Label ID="ProjectStartDateLabel" runat="server" Text='<%# Eval("ProjectStartDate") %>' /></td>
                                <td><asp:Label ID="ProjectDescriptionLabel" runat="server" Text='<%# Eval("ProjectDescription") %>' /></td>
                                <td><asp:Label ID="ProposedAnchorTenantsLabel" runat="server" Text='<%# Eval("ProposedAnchorTenants") %>' /></td>
                                <td><asp:Label ID="GLALabel" runat="server" Text='<%# Eval("GLA") %>' /></td>
                                <td><asp:Label ID="EstCompDateLabel" runat="server" Text='<%# Eval("EstCompDate") %>' /></td>
                                <td><asp:Label ID="DeveloperLabel" runat="server" Text='<%# Eval("Developer") %>' /></td>
                                <td><asp:Label ID="BusinessUnitLabel" runat="server" Text='<%# Eval("BusinessUnit") %>' /></td>
                                <td><asp:Label ID="BULabel" runat="server" Text='<%# Eval("BU") %>' /></td>
                                <td><asp:Label ID="CenterNameLabel" runat="server" Text='<%# Eval("CenterName") %>' /></td>
                                <td><asp:Label ID="MSALabel" runat="server" Text='<%# Eval("MSA") %>' /></td>
                                <td><asp:Label ID="BrixmorMSARankLabel" runat="server" Text='<%# Eval("BrixmorMSARank") %>' /></td>
                                <td><asp:Label ID="CountLabel" runat="server" Text='<%# Eval("Count") %>' /></td>
                                <td><asp:Label ID="RegionLabel" runat="server" Text='<%# Eval("Region") %>' /></td>
                                <td><asp:Label ID="DistancefromNewDevLabel" runat="server" Text='<%# Eval("DistancefromNewDev") %>' /></td>
                            </tr>
                        </ItemTemplate>
                        <AlternatingItemTemplate>
                            <tr style="background-color: rgba(255, 255, 255, 1);">
                                <td><asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" /></td>
                                <td><asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" /></td>
                                <td><asp:Label ID="CompIDLabel" runat="server" Text='<%# Eval("CompID") %>' /></td>
                                <td><asp:Label ID="NewDevCountLabel" runat="server" Text='<%# Eval("NewDevCount") %>' /></td>
                                <td><asp:Label ID="DevelopmentNameLabel" runat="server" Text='<%# Eval("DevelopmentName") %>' /></td>
                                <td><asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' /></td>
                                <td><asp:Label ID="StateLabel" runat="server" Text='<%# Eval("State") %>' /></td>
                                <td><asp:Label ID="ZipCodeofNewDevLabel" runat="server" Text='<%# Eval("ZipCodeofNewDev") %>' /></td>
                                <td><asp:Label ID="ProjectStatusLabel" runat="server" Text='<%# Eval("ProjectStatus") %>' /></td>
                                <td><asp:Label ID="ShoppingCenterLabel" runat="server" Text='<%# Eval("ShoppingCenter") %>' /></td>
                                <td><asp:Label ID="ProjectStartDateLabel" runat="server" Text='<%# Eval("ProjectStartDate") %>' /></td>
                                <td><asp:Label ID="ProjectDescriptionLabel" runat="server" Text='<%# Eval("ProjectDescription") %>' /></td>
                                <td><asp:Label ID="ProposedAnchorTenantsLabel" runat="server" Text='<%# Eval("ProposedAnchorTenants") %>' /></td>
                                <td><asp:Label ID="GLALabel" runat="server" Text='<%# Eval("GLA") %>' /></td>
                                <td><asp:Label ID="EstCompDateLabel" runat="server" Text='<%# Eval("EstCompDate") %>' /></td>
                                <td><asp:Label ID="DeveloperLabel" runat="server" Text='<%# Eval("Developer") %>' /></td>
                                <td><asp:Label ID="BusinessUnitLabel" runat="server" Text='<%# Eval("BusinessUnit") %>' /></td>
                                <td><asp:Label ID="BULabel" runat="server" Text='<%# Eval("BU") %>' /></td>
                                <td><asp:Label ID="CenterNameLabel" runat="server" Text='<%# Eval("CenterName") %>' /></td>
                                <td><asp:Label ID="MSALabel" runat="server" Text='<%# Eval("MSA") %>' /></td>
                                <td><asp:Label ID="BrixmorMSARankLabel" runat="server" Text='<%# Eval("BrixmorMSARank") %>' /></td>
                                <td><asp:Label ID="CountLabel" runat="server" Text='<%# Eval("Count") %>' /></td>
                                <td><asp:Label ID="RegionLabel" runat="server" Text='<%# Eval("Region") %>' /></td>
                                <td><asp:Label ID="DistancefromNewDevLabel" runat="server" Text='<%# Eval("DistancefromNewDev") %>' /></td>
                            </tr>
                        </AlternatingItemTemplate>
                        <EditItemTemplate>
                            <tr>
                                <td><asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" /></td>
                                <td><asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" /></td>
                                <td><asp:Label ID="CompIDLabel1" runat="server" Text='<%# Eval("CompID") %>' /></td>
                                <td><asp:TextBox ID="NewDevCountTextBox" runat="server" Text='<%# Bind("NewDevCount") %>' /></td>
                                <td><asp:TextBox ID="DevelopmentNameTextBox" runat="server" Text='<%# Bind("DevelopmentName") %>' /></td>
                                <td><asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' /></td>
                                <td><asp:TextBox ID="StateTextBox" runat="server" Text='<%# Bind("State") %>' /></td>
                                <td><asp:TextBox ID="ZipCodeofNewDevTextBox" runat="server" Text='<%# Bind("ZipCodeofNewDev") %>' /></td>
                                <td><asp:TextBox ID="ProjectStatusTextBox" runat="server" Text='<%# Bind("ProjectStatus") %>' /></td>
                                <td><asp:TextBox ID="ShoppingCenterTextBox" runat="server" Text='<%# Bind("ShoppingCenter") %>' /></td>
                                <td><asp:TextBox ID="ProjectStartDateTextBox" runat="server" Text='<%# Bind("ProjectStartDate") %>' /></td>
                                <td><asp:TextBox ID="ProjectDescriptionTextBox" runat="server" Text='<%# Bind("ProjectDescription") %>' /></td>
                                <td><asp:TextBox ID="ProposedAnchorTenantsTextBox" runat="server" Text='<%# Bind("ProposedAnchorTenants") %>' /></td>
                                <td><asp:TextBox ID="GLATextBox" runat="server" Text='<%# Bind("GLA") %>' /></td>
                                <td><asp:TextBox ID="EstCompDateTextBox" runat="server" Text='<%# Bind("EstCompDate") %>' /></td>
                                <td><asp:TextBox ID="DeveloperTextBox" runat="server" Text='<%# Bind("Developer") %>' /></td>
                                <td><asp:TextBox ID="BusinessUnitTextBox" runat="server" Text='<%# Bind("BusinessUnit") %>' /></td>
                                <td><asp:TextBox ID="BUTextBox" runat="server" Text='<%# Bind("BU") %>' /></td>
                                <td><asp:TextBox ID="CenterNameTextBox" runat="server" Text='<%# Bind("CenterName") %>' /></td>
                                <td><asp:TextBox ID="MSATextBox" runat="server" Text='<%# Bind("MSA") %>' /></td>
                                <td><asp:TextBox ID="BrixmorMSARankTextBox" runat="server" Text='<%# Bind("BrixmorMSARank") %>' /></td>
                                <td><asp:TextBox ID="CountTextBox" runat="server" Text='<%# Bind("Count") %>' /></td>
                                <td><asp:TextBox ID="RegionTextBox" runat="server" Text='<%# Bind("Region") %>' /></td>
                                <td><asp:TextBox ID="DistancefromNewDevTextBox" runat="server" Text='<%# Bind("DistancefromNewDev") %>' /></td>
                            </tr>
                        </EditItemTemplate>
                        <EmptyDataTemplate>
                            <table runat="server" style="">
                                <tr>
                                    <td>No data was returned.</td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                        <InsertItemTemplate>
                            <tr style="">
                                <td><asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" /></td>
                                <td><asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" /></td>
                                <td>&nbsp;</td>
                                <td><asp:TextBox ID="NewDevCountTextBox" runat="server" Text='<%# Bind("NewDevCount") %>' /></td>
                                <td><asp:TextBox ID="DevelopmentNameTextBox" runat="server" Text='<%# Bind("DevelopmentName") %>' /></td>
                                <td><asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' /></td>
                                <td><asp:TextBox ID="StateTextBox" runat="server" Text='<%# Bind("State") %>' /></td>
                                <td><asp:TextBox ID="ZipCodeofNewDevTextBox" runat="server" Text='<%# Bind("ZipCodeofNewDev") %>' /></td>
                                <td><asp:TextBox ID="ProjectStatusTextBox" runat="server" Text='<%# Bind("ProjectStatus") %>' /></td>
                                <td><asp:TextBox ID="ShoppingCenterTextBox" runat="server" Text='<%# Bind("ShoppingCenter") %>' /></td>
                                <td><asp:TextBox ID="ProjectStartDateTextBox" runat="server" Text='<%# Bind("ProjectStartDate") %>' /></td>
                                <td><asp:TextBox ID="ProjectDescriptionTextBox" runat="server" Text='<%# Bind("ProjectDescription") %>' /></td>
                                <td><asp:TextBox ID="ProposedAnchorTenantsTextBox" runat="server" Text='<%# Bind("ProposedAnchorTenants") %>' /></td>
                                <td><asp:TextBox ID="GLATextBox" runat="server" Text='<%# Bind("GLA") %>' /></td>
                                <td><asp:TextBox ID="EstCompDateTextBox" runat="server" Text='<%# Bind("EstCompDate") %>' /></td>
                                <td><asp:TextBox ID="DeveloperTextBox" runat="server" Text='<%# Bind("Developer") %>' /></td>
                                <td><asp:TextBox ID="BusinessUnitTextBox" runat="server" Text='<%# Bind("BusinessUnit") %>' /></td>
                                <td><asp:TextBox ID="BUTextBox" runat="server" Text='<%# Bind("BU") %>' /></td>
                                <td><asp:TextBox ID="CenterNameTextBox" runat="server" Text='<%# Bind("CenterName") %>' /></td>
                                <td><asp:TextBox ID="MSATextBox" runat="server" Text='<%# Bind("MSA") %>' /></td>
                                <td><asp:TextBox ID="BrixmorMSARankTextBox" runat="server" Text='<%# Bind("BrixmorMSARank") %>' /></td>
                                <td><asp:TextBox ID="CountTextBox" runat="server" Text='<%# Bind("Count") %>' /></td>
                                <td><asp:TextBox ID="RegionTextBox" runat="server" Text='<%# Bind("Region") %>' /></td>
                                <td><asp:TextBox ID="DistancefromNewDevTextBox" runat="server" Text='<%# Bind("DistancefromNewDev") %>' /></td>
                            </tr>
                        </InsertItemTemplate>
                        <LayoutTemplate>
                            <table runat="server">
                                <tr runat="server">
                                    <td runat="server">
                                        <table id="itemPlaceholderContainer" runat="server" border="0" style="">
                                            <tr runat="server" style="background-color: rgba(122, 21, 1, 1); font-weight: bold; color: rgba(255, 255, 255, 1);">
                                                <th runat="server"></th>
                                                <th runat="server"></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton1" style="color: rgba(255, 255, 255, 1);" Text="CompID" CommandName="Sort" CommandArgument="CompID" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton2" style="color: rgba(255, 255, 255, 1);" Text="NewDevCount" CommandName="Sort" CommandArgument="NewDevCount" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton3" style="color: rgba(255, 255, 255, 1);" Text="DevelopmentName" CommandName="Sort" CommandArgument="DevelopmentName" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton4" style="color: rgba(255, 255, 255, 1);" Text="City" CommandName="Sort" CommandArgument="City" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton5" style="color: rgba(255, 255, 255, 1);" Text="State" CommandName="Sort" CommandArgument="State" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton6" style="color: rgba(255, 255, 255, 1);" Text="ZipCodeofNewDev" CommandName="Sort" CommandArgument="ZipCodeofNewDev" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton7" style="color: rgba(255, 255, 255, 1);" Text="ProjectStatus" CommandName="Sort" CommandArgument="ProjectStatus" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton8" style="color: rgba(255, 255, 255, 1);" Text="ShoppingCenter" CommandName="Sort" CommandArgument="ShoppingCenter" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton9" style="color: rgba(255, 255, 255, 1);" Text="ProjectStartDate" CommandName="Sort" CommandArgument="ProjectStartDate" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton10" style="color: rgba(255, 255, 255, 1);" Text="ProjectDescription" CommandName="Sort" CommandArgument="ProjectDescription" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton11" style="color: rgba(255, 255, 255, 1);" Text="ProposedAnchorTenants" CommandName="Sort" CommandArgument="ProposedAnchorTenants" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton12" style="color: rgba(255, 255, 255, 1);" Text="GLA" CommandName="Sort" CommandArgument="GLA" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton13" style="color: rgba(255, 255, 255, 1);" Text="EstCompDate" CommandName="Sort" CommandArgument="EstCompDate" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton14" style="color: rgba(255, 255, 255, 1);" Text="Developer" CommandName="Sort" CommandArgument="Developer" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton15" style="color: rgba(255, 255, 255, 1);" Text="BusinessUnit" CommandName="Sort" CommandArgument="BusinessUnit" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton16" style="color: rgba(255, 255, 255, 1);" Text="BU" CommandName="Sort" CommandArgument="BU" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton17" style="color: rgba(255, 255, 255, 1);" Text="CenterName" CommandName="Sort" CommandArgument="CenterName" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton18" style="color: rgba(255, 255, 255, 1);" Text="MSA" CommandName="Sort" CommandArgument="MSA" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton19" style="color: rgba(255, 255, 255, 1);" Text="BrixmorMSARank" CommandName="Sort" CommandArgument="BrixmorMSARank" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton20" style="color: rgba(255, 255, 255, 1);" Text="Count" CommandName="Sort" CommandArgument="Count" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton21" style="color: rgba(255, 255, 255, 1);" Text="Region" CommandName="Sort" CommandArgument="Region" /></th>
                                                <th runat="server"><asp:LinkButton runat="server" ID="LinkButton22" style="color: rgba(255, 255, 255, 1);" Text="DistancefromNewDev" CommandName="Sort" CommandArgument="DistancefromNewDev" /></th>
                                            </tr>
                                            <tr id="itemPlaceholder" runat="server">
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr runat="server" style="background-color: rgba(237, 45, 34, 1); color: rgba(0, 0, 0, 1); text-align: left;">
                                    <td runat="server">
                                        <asp:DataPager ID="DataPager1" runat="server">
                                            <Fields>
                                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
                                            </Fields>
                                        </asp:DataPager>
                                    </td>
                                </tr>
                            </table>
                        </LayoutTemplate>                        
                    </asp:ListView>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CnnStr %>" DeleteCommand="CompDev_Delete" DeleteCommandType="StoredProcedure" InsertCommand="CompDev_Insert" InsertCommandType="StoredProcedure" SelectCommand="CompDev_Select" SelectCommandType="StoredProcedure" UpdateCommand="CompDev_Update" UpdateCommandType="StoredProcedure">
                        <DeleteParameters>
                            <asp:Parameter Name="CompID" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="NewDevCount" Type="String" />
                            <asp:Parameter Name="DevelopmentName" Type="String" />
                            <asp:Parameter Name="City" Type="String" />
                            <asp:Parameter Name="State" Type="String" />
                            <asp:Parameter Name="ZipCodeofNewDev" Type="String" />
                            <asp:Parameter Name="ProjectStatus" Type="String" />
                            <asp:Parameter Name="ShoppingCenter" Type="String" />
                            <asp:Parameter Name="ProjectStartDate" Type="Double" />
                            <asp:Parameter Name="ProjectDescription" Type="String" />
                            <asp:Parameter Name="ProposedAnchorTenants" Type="String" />
                            <asp:Parameter Name="GLA" Type="String" />
                            <asp:Parameter Name="EstCompDate" Type="Double" />
                            <asp:Parameter Name="Developer" Type="String" />
                            <asp:Parameter Name="BusinessUnit" Type="String" />
                            <asp:Parameter Name="BU" Type="String" />
                            <asp:Parameter Name="CenterName" Type="String" />
                            <asp:Parameter Name="MSA" Type="String" />
                            <asp:Parameter Name="BrixmorMSARank" Type="String" />
                            <asp:Parameter Name="Count" Type="String" />
                            <asp:Parameter Name="Region" Type="String" />
                            <asp:Parameter Name="DistancefromNewDev" Type="String" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="CompID" Type="Int32" />
                            <asp:Parameter Name="NewDevCount" Type="String" />
                            <asp:Parameter Name="DevelopmentName" Type="String" />
                            <asp:Parameter Name="City" Type="String" />
                            <asp:Parameter Name="State" Type="String" />
                            <asp:Parameter Name="ZipCodeofNewDev" Type="String" />
                            <asp:Parameter Name="ProjectStatus" Type="String" />
                            <asp:Parameter Name="ShoppingCenter" Type="String" />
                            <asp:Parameter Name="ProjectStartDate" Type="Double" />
                            <asp:Parameter Name="ProjectDescription" Type="String" />
                            <asp:Parameter Name="ProposedAnchorTenants" Type="String" />
                            <asp:Parameter Name="GLA" Type="String" />
                            <asp:Parameter Name="EstCompDate" Type="Double" />
                            <asp:Parameter Name="Developer" Type="String" />
                            <asp:Parameter Name="BusinessUnit" Type="String" />
                            <asp:Parameter Name="BU" Type="String" />
                            <asp:Parameter Name="CenterName" Type="String" />
                            <asp:Parameter Name="MSA" Type="String" />
                            <asp:Parameter Name="BrixmorMSARank" Type="String" />
                            <asp:Parameter Name="Count" Type="String" />
                            <asp:Parameter Name="Region" Type="String" />
                            <asp:Parameter Name="DistancefromNewDev" Type="String" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>

所以 - 我做了什么: 我设置了一个简单的列表视图,连接到 web.config 中的连接字符串。列表视图有一个连接到该连接字符串的 SQL 数据源,并且它使用上面的存储过程进行数据 CRUD 操作。我什至添加了你的款式,让 LV 看起来就像你的 GV 一样。

如果您不接受这个答案,我也没关系,因为我没有从技术上解决您的 gridview 问题,而是替换它们。也就是说,使用此解决方案将使您的工作顺利进行。 :)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SQL Server 存储过程更新不适用于 ASP.Net C# GridView RowUpdating 的相关文章

  • ListView 内的 TextBox 绑定到对象,双向绑定不起作用

    Edit 好吧 在尝试了无数次但没有成功之后 我创建了一个非常小的 Wpf 应用程序 您可以直接复制此代码 请注意 当您更改文本框中的值并按 测试 按钮时 这些值永远不会更新 我不明白为什么双向绑定不起作用 请帮忙 这是 xaml
  • 选择数据结构

    根据需求使用不同的数据结构 但我如何知道应该使用哪种数据结构 我只是想知道如何选择合适的数据结构 谢谢 此流程图适用于 C 中的 STL 但您可以用 C 实现 STL 容器支持的任何数据结构 列表是一个链接列表 Vector是一个动态数组
  • 策略模式与依赖注入

    策略模式与依赖注入有何不同 即以下是您可以使用策略模式执行的操作 class Foo private readonly ISortAlgo sortAlgo public Foo ISortAlgo sortAlgo sortAlgo so
  • ASP.NET Core处理JSON反序列化问题

    我想更改 ASP NET Core 中无效 JSON 请求处理的默认行为 我有这个模型 public class Model public Guid Id get set 当我用这个 body 发送这个请求时 Id null 它返回此错误消
  • 规避模板专业化

    假设我是某个模板库的用户 CTL 它定义了一个模板 命名为 Hector template
  • 分段错误(核心转储)

    当我尝试运行此程序时 出现分段错误 核心转储 它编译完美 但我收到错误 我不知道为什么 我已尝试以所有可能的方式编辑我的代码 但仍然收到此错误 我已经没有主意了 任何帮助都会很棒 谢谢 unsigned short reg NULL int
  • 有效取消引用空指针的规则是什么?

    include
  • WPF PasswordBox 中的密码不可绑定的安全优势?

    我只是偶然发现一个事实PasswordWPF 的属性PasswordBoxes 不可绑定安全原因 这使得在 MVVM 上下文中使用它们相当麻烦 答案如https stackoverflow com a 1493330 3198247 htt
  • C++14 中专门用于数组类型的分配器?

    为什么 c 14 中没有 std allocator 的数组模板专门化 当我自己尝试专门化 std allocator 时 我在实现 Construction 和 destroy 方法时遇到了死胡同 是这个原因吗 那么为什么 std all
  • Windows窗体C#通过代码改变用户控件

    我有一个 Windows 窗体 我不想将任何其他 Windows 窗体设置为一个 Windows 窗体和不同的用户控件 如何在用户控件之间进行更改 例如以编程方式隐藏一个用户控件并显示另一个用户控件 private void Btt inf
  • 如何在C++中从Imagemagick图像获取缓冲区

    我正在使用 ImageMagick 库进行图像处理 我需要加载 bmp 图像 将其转换为 jpeg 将其加载到缓冲区中并通过网络发送 但是 我在 ImageMagick 中找不到任何可以在缓冲区中转换和存储数据的支持函数 我只能写入文件 尝
  • 单元测试依赖注入

    我在用Autofac for IoC 这是我的容器启动器类 其职责是注册依赖项 public class ContainerInit public static IContainer BuildContainer var conFac ne
  • 为什么 _popen 在这里可以工作,而 boost::process 却不能?

    我在 Windows 上使用 popen 有以下工作代码 m pGNUPlot popen gnuplot bin gnuplot exe w fprintf m pGNUPlot set term win n fprintf m pGNU
  • Json.Net 反序列化 JSON 对象,索引为名称 [重复]

    这个问题在这里已经有答案了 我尝试使用 Json NET 从 Web 服务解析 JSON 该 Web 服务返回以下格式的数据 0 ID 193 Title Title 193 Description Description 193 Orde
  • SSIS:无法创建 OLE DB 访问器。验证列元数据是否有效

    我有一个 SSIS 包 在 OLEDB 目标中具有 NVARCHAR MAX 字段 该字段甚至没有被数据流填充 数据流任务失败并出现错误 无法创建 OLE DB 访问器 请验证列元数据是否有效 我看到了这个类似的问题 如何修复 SSIS 中
  • 在哪里可以查看 LINQ 源代码?

    我需要编写自己版本的 except 方法 或者至少以某种方式修改 LINQ 方法的工作方式 我正在与大型自定义对象列表进行比较 并且需要将匹配项从列表 A 连接到列表 B 我认为除外哈希表构建是进行比较的最快方法 但该方法只会返回非匹配项
  • 在 OpenGL 中绘制 2D 纹理 [关闭]

    Closed 这个问题需要调试细节 help minimal reproducible example 目前不接受答案 我有一个绘图函数叫做DrawImage但这确实令人困惑 并且仅适用于特定形式的重塑函数 所以我有两个问题 如何在 Ope
  • 如何确保 IsInRole 检查不使用缓存的凭据

    我有一个连接到 WCF 服务的 WPF 客户端 我想锁定某些功能 以便只有某些用户可以执行某些操作 WCF 服务在执行服务方法时模拟客户端用户 操作系统是Windows XP 我正在读书这个问题 https stackoverflow co
  • 反序列化 jQuery 序列化表单

    我正在尝试将表单输入传递到 WebMethod 中并执行某些操作 我用了jQuery 序列化 http api jquery com serialize
  • “auto_ptr”和 STL 容器:编写错误用法的示例

    读完本教程后提出这个问题 http www cprogramming com tutorial auto ptr html http www cprogramming com tutorial auto ptr html 在那里你可以找到以

随机推荐