Add to Favorites    Make Home Page 8722 Online  
 Language Categories  
 Our Services  

Home » ASP Home » SQL Home » Delete Unwanted Email Addreses

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title Delete Unwanted Email Addreses
Description A nifty script to delete unwanted or invalid Email addresses from a database. Works with Access mdb and SQL Server databases.
Category ASP » SQL
Hits 379557
Code Select and Copy the Code
'************************************** ' Name: Delete unwated Email Addresses ' Description:A nifty script to delete u ' nwanted or invalid Email addresses from ' a database. Works with Access mdb and SQ ' L Server databases. No config required, ' ready to use. Can be used for cleaning u ' p any other unwanted records as well ' By: Cenk Yurtseven ' ' Returns:Deletes all unwanted email add ' resses from a database in one step. ' ' Assumes:The code can bu used for remov ' ing any other records as well. The user ' must be able to change the field name in ' the code. ' ' Side Effects:The script deletes the un ' wanted records in all tables and fields ' of the selected database regardless of t ' he table or field names. <%@Language="vbscript" %> <% '*************************************** ' ************************************* ' This script deletes all unwanted Email ' addresses from a database in multiple ta ' bles ' Note: If your email address field name ' is not named "EMail", change the field n ' ame EMail to your fields name..... ' '*************************************** ' ************************************* Const adOpenForwardOnly = 0 Const adLockReadOnly = 1 Const adCmdText = &H0001 Const adUseClient = 3 If Request.QueryString("md") = "dl" And Request.Form("sAddress") <> "" And Request.Form("dbName") <> "" Then DSNName = Request.Form("dbName") & ".mdb" Set Con = Server.CreateObject("ADODB.Connection") Con.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(DSNName) strAddresses = Request.Form("sAddress") splitAddress = Split(strAddresses, ",") Set Table = Con.OpenSchema (20) Do While Not Table.EOF TblName = Table("Table_Name") 'The condition below excludes the system tables from beeing processed If UCase(Left(TblName,4)) <> "MSYS" And UCase(Left(TblName,3)) <> "SYS" And UCase(Left(TblName,4)) <> "RTBL" Then strSQL = "SELECT * FROM " & TblName Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = adUseClient rs.Open (strSQL), Con, adOpenForwardOnly, adLockReadOnly, adCmdText For Each fldName In rs.Fields If fldName.Name = "EMail" Then For i = 0 To UBound(splitAddress) oneAddress = Trim(splitAddress(i)) strSQL = "DELETE FROM " & TblName & " WHERE EMail = '" & oneAddress & "'" Con.Execute(strSQL) Next End If Next rs.Close Set rs = Nothing End If Table.MoveNext Loop Con.Close Set Con = Nothing End If %> <!DOCTYPE HTML Public "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>Delete Multiple Addresses</TITLE> </HEAD> <BASEFONT FACE="Verdana"> <BODY BGCOLOR="#000080" Text="#FFFFFF"> <BR> <DIV ALIGN="center"><B>Delete Multiple Addresses</B> <FORM ACTION="deladdre.asp?md=dl" METHOD="post">Database Name: <Input Type="text" NAME="dbName" STYLE="text-align: right"><B>.mdb</B> <BR> <BR>Paste all unwanted addresses into the textarea below, separated by a comma<B>,</B> <BR> <TEXTAREA COLS="80" ROWS="8" NAME="sAddress"></TEXTAREA> <Input Type="submit" VALUE="Delete Addresses"></FORM> <SMALL><B>Note:</B> This action will delete the selected addresses from all tables of the selected database.</SMALL> <BR> <BR>This file must be located In the same folder of the database.</DIV> </BODY> </HTML>

Related Source Codes

Script Name Author
��������������������� VyomWorld
Resistor color code reader A.Chermarajan.
Telephone Directory dhivya
card swapping game (Mini Project) nityanand
simple hangman-pascalsource Seabert
college dirtectory (Mini Project) msridhar
Poll Application John van Meter
ASP Daily Hit Counter. Tejaskumar Gandhi
To avoid null in asp environment using sql Sami
Maklumbalas webmaster
poll John van Meter
EasyASP Template Engine. TjoekBezoer
Basic Calculator using HTML & Javascript. Patrick M. D Souza
What servers support ASP ? VyomWorld
What is ASP? VyomWorld

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=211


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review