.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

Delete Multiple Records

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
 
Hai friends,            How to delete multiple records using checkbox in gridview?


View Complete Post


More Related Resource Links

how to delete records from multiple tables.

  

Hi Friends,Tell me How to delete records from multiple tables by using a single query.


search multiple words into textbox and populate all records in gridview related those keywords

  

I have a textbox and a gridview which is bound to a table

what I want to achieve is a solution where lets say there are two records - e.g. "1. Book and 2. Red", i want a user to type in those words and the gridview shows the results as followed;

1. Book

2. Red

I have set up the sql data source and everything and my like operator is this...

LIKE '%' + @record + '%'

how can I solve this problem?


Receive/Delete Multiple FTP Files based on condition using SCRIPT(VB) TASK

  
I am trying to receive and delete multiple FTP files from a remote FTP server using Script task Below is the code   Dim FTPConnMgr As ConnectionManager FTPConnMgr = Dts.Connections("FTP Connection Manager") Dim FTPClientConn As FtpClientConnection = New FtpClientConnection(FTPConnMgr.AcquireConnection(Nothing)) Dim FileTimeStampNew As String = "20100913021807" Dim remoteFileNames(0) As String remoteFileNames(0) = Dts.Variables("FtpRemoteDirectory").Value & "*" & FileTimeStampNew & ".*" 'Below hardcoded FileName works good. But the problem is there are lots of file in the FTP folder that I dont want to receive 'remoteFileNames(0) = Dts.Variables("FtpRemoteDirectory").Value & "Company_alpha_Full_20100913021807.xml" Dim localPath As String = Dts.Variables("FtpLocalDirectory").Value FTPClientConn.Connect() FTPClientConn.ReceiveFiles(remoteFileNames, localPath, False, False) FTPClientConn.Close() Dts.TaskResult = ScriptResults.Success End Sub End Class If i specifically mention the RemotefileNames this works fine but, when I say *.* it executes succefully but doesn't receives the file. Please advice how to receive multiple file based on a variable BR, AWM

Allow or deny roles to update, insert and delete records.

  
Hello, I have two roles "Admin" and "Basic". I also have a listview on the web page. My goal is that to make "Admin" role has the highest privilege to deal with records such as "insert", "update" and "delete". For the role "Basic", it only can update the records. Is there any sample code for that? Thanks.  

I have relation many to many - how can I delete records from intermediate table ?

  
I have tables: Books id title Authors id name BooksAuthors book_id author_id Entity Framework generated only models for tables Books and Authors in relation many to many. How can I delete from table BooksAuthors all records where book_id =5 ?

MULTIPLE RECORDS SINGLE COLUMN SQL SERVER 2000

  
Hi Friends, I am creating an application for a jewellery shop (MINOR PROJECT) in VB.Net but my problem is that I dont know how to insert multiple records for same bill number. consider the following condition Bill Number Customer Name   ............................................... Customer Address ................................................ S.No                 Item name                Rate    Qty                            Total 1                      abc                            5        5                                 25 2                 &nb

Inserting multiple records under the single query

  
Hi All,       I have to insert a multiple records under the single table.So i have to execute the command in the frontend for every records. Inorder to avoid i write the query like this   insert into table1(field1,field2) values('1','Test1'),('2','Test2'); and also i tried insert into table1(field1,field2) SELECT "1","Test1" Union all SELECT "2","Test2" But I am getting syntax error. How to insert a multiple records under the single query???...

Is the delete records LINQ correct ?

  
I hope to delete all records in DBPrograms, is the following code correct?               DBContext db = DBContext(PublicDBPar.ConnectionString);            db.DBPrograms.DeleteAllOnSubmit(db.DBPrograms);            db.SubmitChanges();

Display records in multiple columns in asp.net mvc

  
 Hello,i'm newbie to asp.net mvc. i use mvc 1.0 since my host supports that.i have a piece of code in my view like this and i want to change it in order to be able to show records in 4 columns.What should i do?<table>            <% foreach (var item in Model) { %>                     <tr>                                  <td>    <%=Html.ActionLink(item.CategoryName + "(" + item.NumberOfWebsitesInCategory + ")", "SubCategory", new { CatID = item.CategoryID }, new {style="text-decoration:none;" })%>                         </td>                    </tr>        <% } %>    </table>

how to delete records automatically at server side

  
the application which i created is a web application which doesnt need much of a database,so i am just using the sql express  free version which allows 4 gb of data,to avoid disasters iw ould like to delete records which are very old like,1 month,2 months old etc,how can i do this periodically should i do this on client side or the server side... what id there are 100000 records and if we put this in page load or some method,it could take some time to delete,which i dont want..........can anyone suggest how i can automate this process at the server side only Please help me... thanks  

Delete from multiple tables

  
 After trying myriad ways to accomplish deleting from two table, I found a way that actually works. However, AM am sure there is a better way to do this. Any ideas?  Imports System.Data Imports System.Data.SqlClient Imports Telerik.Web.UI Imports System.CodeDom Imports System.Web Partial Class Default2 Inherits System.Web.UI.Page Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sql As String Dim strConnString As [String] = System.Configuration.ConfigurationManager.ConnectionStrings("CF_SQL_Connection").ConnectionString() sql = "DELETE FROM Table1 WHERE IDTable1 = '5'" Dim connection As New SqlConnection(strConnString) Dim command As New SqlCommand(sql, connection) command.Connection.Open() command.ExecuteNonQuery() command.Connection.Close() Dim sql1 As String Dim strConnString1 As [String] = System.Configuration.ConfigurationManager.ConnectionStrings("CF_SQL_Connection").ConnectionString() sql1 = "DELETE FROM Table2 WHERE IDTable1 = '5'" Dim connection1 As New SqlConnection(strConnString) Dim command1 As New SqlCommand(sql1, connection) command1.Connection.Open() command1.ExecuteNonQuery() command1.Connec

How to delete many records with minimal locks and IO?

  
hi, I have a larg db (160GB) that used both as OLTP and DW. there are several large tables that normally experience 10k-30k transactions per hour. most of them are INSERT and part are UPDATE. Tables have cluster PK of 5-8 fields with datetime one of them. tables have several indexes. normally we dont delete records. BUT, end-user may quit service once in a while and in this case we have a job to delete all his raw data. we have a job that tries to do it in small chunks to reduce impact on other processing jobs, but actually it slows down all other important transactions with long locks. I would like to know what is the best way to delete records from a large table with minimum impact on other transactions (insert and update). The delete task is a background job that is executed during night and may take many hours. here is my code: ALTER     PROCEDURE SP_ADMIN_DEL_DATA     @CompanyID int,     @itemID nvarchar(50) = '-1' AS begin     -- @itemID = -1 for all items     declare @d datetime     declare @upperDate datetime       set @upperDate = dbo.FN_DateOnly(getdate() + 1)     set @d = @upperDate - 800     while @d <= @upperDate     begin     begin tran     DELETE I_EVENTS with (PAGLOC

How to delete many records with minimal locks and IO?

  
How to delete many records with minimal locks and IO? hi, I have a larg db (160GB) that used both as OLTP and DW. there are several large tables that normally experience 10k-30k transactions per hour. most of them are INSERT and part are UPDATE. Tables have cluster PK of 5-8 fields with datetime one of them. tables have several indexes. normally we dont delete records. BUT, end-user may quit service once in a while and in this case we have a job to delete all his raw data. we have a job that tries to do it in small chunks to reduce impact on other processing jobs, but actually it slows down all other important transactions with long locks. I would like to know what is the best way to delete records from a large table with minimum impact on other transactions (insert and update). The delete task is a background job that is executed during night and may take many hours. here is my code: ALTER @CompanyID     int, @itemID     nvarchar(50) = '-1' AS begin -- @itemID = -1 for all items declare     @d   declare     @upperDate   set     @upperDate = dbo.FN_DateOnly(getdate() + 1) set     @d = @upperDate - 800 while     @d <= @upperDate begin begin     tran DELETE       I_EVENTS with (PAGLOCK) WHERE     G_COMPANY_ID

How to delete many records with minimal locks and IO?

  
How to delete many records with minimal locks and IO? hi, I have a larg db (160GB) that used both as OLTP and DW. there are several large tables that normally experience 10k-30k transactions per hour. most of them are INSERT and part are UPDATE. Tables have cluster PK of 5-8 fields with datetime one of them. tables have several indexes. normally we dont delete records. BUT, end-user may quit service once in a while and in this case we have a job to delete all his raw data. we have a job that tries to do it in small chunks to reduce impact on other processing jobs, but actually it slows down all other important transactions with long locks. I would like to know what is the best way to delete records from a large table with minimum impact on other transactions (insert and update). The delete task is a background job that is executed during night and may take many hours. here is my code: ALTER @CompanyID     int, @itemID     nvarchar(50) = '-1' AS begin -- @itemID = -1 for all items declare     @d   declare     @upperDate   set     @upperDate = dbo.FN_DateOnly(getdate() + 1) set     @d = @upperDate - 800 while     @d <= @upperDate begin begin     tran DELETE       I_EVENTS with (PAGLOCK) WHERE     G_COMPANY_ID

Delete records if it is not getting inserted and also in the related tables

  
Hi All, If the insert into table person is successful, but the insert into table subject fails, delete the person record and all records associated with the person that were also inserted. If the insert into table person is successful, and the insert into subject is successful, but the insert into the booking table fails, delete the subject record, the person record ,and all records associated with the person that were also inserted. The reason for the failure into the 3 tables (person, subject, booking) should be logged to tblErrors . Also, a message should be written to tblErrors which logs the fact that this situation has occurred.     -- I have few stored procs which does inserts and updates How would i capture the record which is not getting inserted and log in to log table and delete the previous records which got inserted  which are related to that.

Cannot get distinct records from a multiple inner join request

  

Hello everybody,

This is my first post here because this request is giving me serious headache.

What I'm trying to do : This is a small search engine. I ask SQL Server 2008 to return the 20 records I need in a specific page from a larger set of 1000 records. Then I want it to return only distinct records on the key t_ye.numenr (VID).

This returns doubled or tripled records. What am I doing wrong ?

Thanks

 

declare @explicitMaximum int <br/>
declare @chosenPage int <br/>
declare @recordsPerPage int <br/>
set @explicitMaximum = 1000 <br/>
set @chosenPage = 1 <br/>
set @recordsPerPage =20; <br/>
WITH X AS (<br/>
SELECT DISTINCT TOP(@explicitMaximum) t_ye.numenr AS VID, <br/>
ROW_NUMBER() 

Most Recent records from one of the table among the tables in multiple joins.

  

Hi All

I have a single select query with multiple table joins in it.

I want to retrieve the Most Recent records from one of the table among the tables in multiple joins.

EXAMPLE:

(select t1.col1, t2.col2 , t3.col3, t4.col4, t4.Add_Date,t5.col5,

from dbo.table1 t1

left outer join dbo.table2 t2 on t1.col1=t2.col2

left outer join

(select col3 from dbo.table3 where condition1="expr") as t3

on t1.col1=t3.col3

left outer join dbo.table4 t4 on t1.col1=t4.col4 order by t4.Add_Date

left outer join dbo.table5 t5 on t1.col1=t5.col5 )

Problem is that, I am not able to use the "Order by" for a particular table.

Thanks

 


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend