Help with Loop in VB.Net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roxcy
    New Member
    • Jun 2006
    • 3

    #1

    Help with Loop in VB.Net

    I have an excel sheet where there are some records.My condition is that if ID no exists then mail should be sent to the user along with corresponding records if not it should say no record found.The email address of user is userdeined.
    I am having trouble while looping through the records .The mail just keeps on repeating along with the attachments.Bel ow is my code.Can anyone plz find an appropriate solution?

    For rc = 0 to ds.tables(0).ro ws.count -1

    if ds.tables(0).ro ws(rc).item(0) = "123" then

    with message
    .from = strfrom
    .to=kale2yahoo. com
    .subject="Recor d exists for the ID NO 123"
    .mailpriority=h igh
    .attachments.ad d(new mail attachment(file name)

    end with
    smtpserver = pi.mysdf.lighu. com
    smtpserver.send (message)

    else
    with message
    .from = strfrom
    .to=kale2yahoo. com
    .subject="No Record exists for the ID NO 123"
    .mailpriority=h igh

    end with
    smtpserver = pi.mysdf.lighu. com
    smtpserver.send (message)
    next


    Thanks....
Working...