<asp:SqlDataSource ID="SqlDataSource2" runat="server"  DataSourceMode=DataSet 
          
          ConnectionString="<%$ ConnectionStrings:drmConnectionString2 %>" 
          
          SelectCommand="SELECT [ProgramID], [IsAvailable], [ProgramTitle], [ProgramRe], [ProgramContent], [MovieCount], [WholesalePoint], [PromotionPoint], [ContentProvider] FROM [ProgramData]"
         
          DeleteCommand="DELETE FROM [ProgramData] WHERE [ProgramID] =@ProgramID" 
          
          InsertCommand="INSERT INTO ProgramData(ProgramTitle, IsAvailable, MovieCount, WholesalePoint, PromotionPoint, ContentProvider,ProgramRe,ProgramContent) VALUES (@ProgramTitle, @IsAvailable,@MovieCount, @WholesalePoint, @PromotionPoint, @ContentProvider,@ProgramRe,@ProgramContent)"
            
          UpdateCommand="UPDATE [ProgramData] SET [ProgramTitle] = @ProgramTitle, [IsAvailable] = @IsAvailable, [MovieCount] = @MovieCount, [WholesalePoint] = @WholesalePoint, [PromotionPoint] = @PromotionPoint, [ContentProvider] = @ContentProvider, [ProgramRe] = @ProgramRe, [ProgramContent] = @ProgramContent WHERE [ProgramID] = @ProgramID"
            
          ConflictDetection="CompareAllValues" >
              
              <DeleteParameters>
                 <asp:Parameter Name="ProgramID" Type=Int32 />
              </DeleteParameters>
              <InsertParameters>
                 <asp:FormParameter Name="ProgramTitle" FormField="ProgramTitle" />
                 <asp:FormParameter Name="IsAvailable" FormField="IsAvailable" />
                 <asp:FormParameter Name="MovieCount" FormField="MovieCount" />
                 <asp:FormParameter Name="WholesalePoint" FormField="WholesalePoint" />
                 <asp:FormParameter Name="PromotionPoint" FormField="PromotionPoint" />
                 <asp:FormParameter Name="ContentProvider" FormField="ContentProvider" />
                 <asp:FormParameter Name="ProgramRe" FormField="ProgramRe" />
                 <asp:FormParameter Name="ProgramContent" FormField="ProgramContent" />             
              </InsertParameters>
              <UpdateParameters>
                 <asp:Parameter Name="ProgramTitle"  Type=String/>
                 <asp:Parameter Name="IsAvailable"  Type=Int32/>
                 <asp:Parameter Name="MovieCount"  Type=Int32/>
                 <asp:Parameter Name="WholesalePoint"  Type=Decimal/>
                 <asp:Parameter Name="PromotionPoint"  Type=Decimal />
                 <asp:Parameter Name="ContentProvider" Type=String/>
                 <asp:Parameter Name="ProgramRe"   Type=String/>
                 <asp:Parameter Name="ProgramContent"  Type=string/>  
              </UpdateParameters>
          </asp:SqlDataSource>
我在执行的时候  插入和删除都没有问题  更新的时候不起作用 也没有包错
请高手指点一下 急急急急急急急急急急急急急急急!!!!!!!!1

解决方案 »

  1.   

    启动SQL性能分析器SQL Server Profiler,跟踪一下更新时发送的SQL语句自然就明白了另外,更新参数列表<UpdateParameters>里好像少了关键字段参数<asp:Parameter Name="ProgramID" Type=Int32 />,加上试试
      

  2.   

    SqlDataSource  onupdating 输出@ProgramID的值看看吧
      

  3.   

    ConflictDetection="CompareAllValues" 去掉试试,这个启用了OldValue字典,而你又没制定OldValueFormatString,所以把NewValue 覆盖了