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 !






Vbs Script to get 5 days back registered customer details from DataBase every Day


Posted Date: 19 Sep 2008    Resource Type: Articles    Category: Databases

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



Hi
here I implemented .VBS file which runs the Data Base every day at given time period and get the details of the persons who registered in 5 days back and also it send those details to the administrator mail-id.

.vbs file with ASP; it doesn't allows the ASP server object

for example
in ASP: Set recset = Server.CreateObject("ADODB.Recordset")

we have to change it to

Set recset = CreateObject("ADODB.Recordset")

Here is the example code :

you can modify the following statements to run that file

1. Data base connection
2. Table name and field names

============

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

select your .VBS file

and give the time to run it daily







































Attachments

  • VBS script to get last 5 days back registered persons details (21365-191034-test.vbs.txt)



  • Responses


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

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Yugi script  .  

    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 Questions 3
    Previous Resource: Stored Procedures
    Return to Discussion Resource Index
    Post New Resource
    Category: Databases


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers   BizTalk Adaptors    Web Design

    conference calls

    Contact Us    Privacy Policy    Terms Of Use