C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Script to Run DataBase Daily to update reacords and send mail to admin about updated Recoreds


Posted Date: 24 Sep 2008    Resource Type: Code Snippets    Category: SQL

Posted By: Yugi       Member Level: Gold
Rating:     Points: 10



This code show how to run daily update on DB

Set adoCon = CreateObject("ADODB.Connection")
with adoCon
.connectionTimeout = 2000
.open "Provider=providername;Server=servername;Database=DBname;UID=userid;PWD=password;"
end with

Set recset = CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM CUSTOMERS WHERE REGDATE<'" & DateAdd("d",-4,Date())&"'"
recset.open strSQL, adocon, 1
int n=0

dim ROLE()
dim NAME()
dim count
count=0
if recset.RecordCount>0 then

ReDim ROLE(CInt(recset.RecordCount))
ReDim NAME(CInt(recset.RecordCount))
while not recset.EOF

NAME(count)=recset("NAME")
ROLE(count)=recset("ROLE")
count=count+1
recset.MoveNext
wend
end if
strEmail = "NAME ROLE"&vbCr
for i=0 to count-1

strEmail = strEmail &" "&NAME(i)&" "&ROLE(i)&vbCr

next

Set Mailer = CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "administrator/UR name "
Mailer.FromAddress = "Mail-ID"
Mailer.RemoteHost = "localhost"
Mailer.AddRecipient "abc@gmail.com"
Mailer.Subject = "5days back registerd persons details"
Mailer.BodyText = strEmail
Mailer.ContentType = "text/html"
Mailer.SendMail
Set Mailer = nothing




'CloseConnections
on error resume next
recset.close
set recset = nothing

adoCon.close
set adoCon = nothing


=============================
save the file with .vbs extension


Setup this file to run daily at given period by auto


start>control panel>scheduled task> Add scheduled task>Next >Browse





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Script  .  Database  .  .vbs  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: SQL function to split
Previous Resource: MYSQL Procedure with SQLTransactions and Exception Handling
Return to Discussion Resource Index
Post New Resource
Category: SQL


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

SPOC

Contact Us    Privacy Policy    Terms Of Use