本文介绍了使用asp.net更新不在gripview中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< asp:GridView ID =GridView1runat =serverAllowPaging =True
AutoGenerateColumns =FalseDataKeyNames =SRNODataSourceID =shift>
< columns>
< asp:BoundField DataField =SRNOHeaderText =SRNOReadOnly =True
SortExpression =SRNO/>
< asp:CommandField ShowEditButton =True/>
< asp:BoundField DataField =LOCATIONHeaderText =LOCATION
SortExpression =LOCATION/>
< asp:BoundField DataField =NAT_WORKHeaderText =NAT_WORK
SortExpression =NAT_WORK/>
< asp:BoundField DataField =TARGETDATEHeaderText =TARGETDATE
SortExpression =TARGETDATE/>
< asp:BoundField DataField =WORKPROGHeaderText =WORKPROG
SortExpression =WORKPROG/>
< asp:BoundField DataField =DONEBYHeaderText =DONEBY
SortExpression =DONEBY/>
< asp:BoundField DataField =DONEONHeaderText =DONEON
SortExpression =DONEON/>
< asp:BoundField DataField =READYHeaderText =READYSortExpression =READY/>
< asp:BoundField DataField =SHOWHeaderText =SHOWSortExpression =SHOW/>
< / columns>

< asp:SqlDataSource ID =shiftrunat =server
ConnectionString =<%$ ConnectionStrings:constr%>
ProviderName =<%$ ConnectionStrings:constr.ProviderName%>
SelectCommand =SELECT * FROMGMOSHIFT
InsertCommand =INSERT INTOGMOSHIFT(SRNO,LOCATION,NAT_WORK,TARGETDATE,WORKPROG,DONEBY ,DONEON,READY,SHOW)VALUES(:SRNO,:LOCATION,:NAT_WORK,:TARGETDATE,:WORKPROG,:DONEBY,:DONE,:READY,:SHOW)>
< insertparameters>
< asp:参数名称=SRNO类型=十进制/>
< asp:参数名称=LOCATIONType =String/>
< asp:参数名称=NAT_WORK类型=字符串/>
< asp:参数名称=TARGETDATEType =String/>
< asp:参数名称=WORKPROGType =String/>
< asp:参数名称=DONEBYType =String/>
< asp:参数名称=DONEONType =String/>
< asp:参数名称=READYType =String/>
< asp:参数名称=SHOWType =String/>
< / insertparameters>
解决方案




<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" DataKeyNames="SRNO" DataSourceID="shift">
            <columns>
                <asp:BoundField DataField="SRNO" HeaderText="SRNO" ReadOnly="True" 
                    SortExpression="SRNO" />
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="LOCATION" HeaderText="LOCATION" 
                    SortExpression="LOCATION" />
                <asp:BoundField DataField="NAT_WORK" HeaderText="NAT_WORK" 
                    SortExpression="NAT_WORK" />
                <asp:BoundField DataField="TARGETDATE" HeaderText="TARGETDATE" 
                    SortExpression="TARGETDATE" />
                <asp:BoundField DataField="WORKPROG" HeaderText="WORKPROG" 
                    SortExpression="WORKPROG" />
                <asp:BoundField DataField="DONEBY" HeaderText="DONEBY" 
                    SortExpression="DONEBY" />
                <asp:BoundField DataField="DONEON" HeaderText="DONEON" 
                    SortExpression="DONEON" />
                <asp:BoundField DataField="READY" HeaderText="READY" SortExpression="READY" />
                <asp:BoundField DataField="SHOW" HeaderText="SHOW" SortExpression="SHOW" />
            </columns>
        
        <asp:SqlDataSource ID="shift" runat="server" 
            ConnectionString="<%$ ConnectionStrings:constr %>" 
            ProviderName="<%$ ConnectionStrings:constr.ProviderName %>" 
            SelectCommand="SELECT * FROM "GMOSHIFT"" 
            InsertCommand="INSERT INTO "GMOSHIFT" ("SRNO", "LOCATION", "NAT_WORK", "TARGETDATE", "WORKPROG", "DONEBY", "DONEON", "READY", "SHOW") VALUES (:SRNO, :LOCATION, :NAT_WORK, :TARGETDATE, :WORKPROG, :DONEBY, :DONEON, :READY, :SHOW)">
            <insertparameters>
                <asp:Parameter Name="SRNO" Type="Decimal" />
                <asp:Parameter Name="LOCATION" Type="String" />
                <asp:Parameter Name="NAT_WORK" Type="String" />
                <asp:Parameter Name="TARGETDATE" Type="String" />
                <asp:Parameter Name="WORKPROG" Type="String" />
                <asp:Parameter Name="DONEBY" Type="String" />
                <asp:Parameter Name="DONEON" Type="String" />
                <asp:Parameter Name="READY" Type="String" />
                <asp:Parameter Name="SHOW" Type="String" />
            </insertparameters>
解决方案




这篇关于使用asp.net更新不在gripview中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 13:13