从表中删除记录不会影响数据库

时间:2016-05-19 06:01:26

标签: vb.net sql-server-2008

如果我尝试删除表中的记录但是如何使用它,我不知道。

在radgrid我使用删除链接,如果我按删除它,我会工作,但我尝试下一级删除。

如果我按删除该数据我将在网格上删除,但它不会影响Sql数据库但我们不能存储来自其他表的数据可以解释如何使用它。 / p>

<Telerik:RadGrid ID="GVUpload" runat="server" AllowMultiRowSelection="false" GridLines="None"
                                                                      CellPadding="1" CellSpacing="1" HeaderStyle-HorizontalAlign="Center" Skin="WebBlue"
                                                                      AllowPaging="true" PageSize="1000" Height="360PX" Width="100%">


  <ClientSettings EnableRowHoverStyle="true">
    <Selecting AllowRowSelect="false" />
    <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2" />
    <Resizing AllowColumnResize="true" />
  </ClientSettings>
  <MasterTableView AutoGenerateColumns="false" DataKeyNames="pendingdump_gid">
    <Columns>
      <Telerik:GridTemplateColumn HeaderText="Select" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ItemStyle-Width="10%" HeaderStyle-Width="10%" >
        <HeaderTemplate>
          <asp:CheckBox id="chkall" Text="Select" runat="server" Checked="false" onclick="javascript:select_deselectAll (this.checked, this.id, 'chkall','chkupload');" />
        </HeaderTemplate>
        <ItemTemplate>
          <asp:CheckBox ID="chkupload" runat="server" CausesValidation="false" Checked="false" onclick="javascript:select_deselectAll (this.checked, this.id, 'chkall','chkupload');" />
        </ItemTemplate>
      </Telerik:GridTemplateColumn>
      <Telerik:GridBoundColumn DataField="pendingdump_gid" HeaderText="Cust ID" Visible="false"
          ItemStyle-HorizontalAlign="Center">
      </Telerik:GridBoundColumn>
      <Telerik:GridBoundColumn DataField="pendingdump_date" HeaderText="Date" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="10%" HeaderStyle-Width="10%"  ></Telerik:GridBoundColumn>
      <Telerik:GridBoundColumn DataField="pendingdump_refno" HeaderText="Ref.No." ItemStyle-HorizontalAlign="Left" ItemStyle-Width="30%" HeaderStyle-Width="20%" ></Telerik:GridBoundColumn>
      <Telerik:GridBoundColumn DataField="pendingdump_name" HeaderText="Party's Name" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" HeaderStyle-Width="10%" ></Telerik:GridBoundColumn>
      <Telerik:GridBoundColumn DataField="pendingdump_amount" HeaderText="Pending Amount" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" HeaderStyle-Width="10%" ></Telerik:GridBoundColumn>
      <Telerik:GridBoundColumn DataField="pendingdump_duedate" HeaderText="Due On" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" HeaderStyle-Width="10%" ></Telerik:GridBoundColumn>
      <Telerik:GridBoundColumn DataField="pendingdump_overduedays" HeaderText="Overdue by Days" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" HeaderStyle-Width="20%" ></Telerik:GridBoundColumn>
      <Telerik:GridTemplateColumn HeaderText="Action" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ItemStyle-Width="30%" HeaderStyle-Width="20%" >
        <ItemTemplate>
          <asp:LinkButton ID="lnkbtnDelete" runat="server" Text="Delete" CausesValidation="false" ToolTip="Click to Delete"
               OnClientClick="javascript:return confirmDelete();" CommandName="lnkbtnDelete" CommandArgument=''
            <%# DataBinder.Eval(Container.DataItem, "pendingdump_gid") %>'>
          </asp:LinkButton>
        </ItemTemplate>
      </Telerik:GridTemplateColumn>
    </Columns>
    <PagerStyle HorizontalAlign="Right" />
  </MasterTableView>
</Telerik:RadGrid>
      Protected Sub GVUpload_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles GVUpload.ItemCommand

            lblerrmsg.Text = ""

            If e.CommandName = "lnkbtnDelete" Then

                Gobjdbconn.OpenConn()

                MsSql = ""
                MsSql = "Delete vsolv_tmp_tpendingdump where pendingdump_gid = '" & e.CommandArgument() & "' and pendingdump_isremoved = 'N'"

                MnResult = Gobjdbconn.ExecuteNonQuerySQL(MsSql)

                If MnResult = 1 Then
                    lblerrmsg.Text = "Record Deleted Successfully"
                Else
                    lblerrmsg.Text = "Record not Deleted"
                End If

                POPSummary()

            End If


        End Sub

0 个答案:

没有答案