Counting

DayWalker

Well-known member
Joined
Jul 9, 2003
Messages
51
Can anyone maybe suggest a better way of doing this. Basically i need to get the value of (i) so that it tells me how many times the Serial number exsists in the DB. Any help would be greatly appreciated.

vb: Dim daRepeatCall As New SqlDataAdapter("SELECT * FROM CallLog", GlobalConn)
Dim dsRepeatCall As New DataSet

daRepeatCall.Fill(dsRepeatCall, "CallLog")
Dim dr As SqlDataReader
Dim comm As New SqlCommand("SELECT SerialNum, Call_Num FROM CallLog", GlobalConn)

Dim i As Integer


GlobalConn.Open()
dr = comm.ExecuteReader
While dr.Read

If dr(i) = txtSerialNumber.Text Then


MsgBox("This is a repeat call number! It has in " & (i) & " times")

Send a notification mail

mailMsg.From = "Server@Mail.com"
mailMsg.To = "User1@mail.com"
mailMsg.Cc = "User2@mail.com"
mailMsg.Bcc = "User3@mail.com"
mailMsg.Subject = "Repeat Job"
mailMsg.Body = "Call number is a repeat call OUT." & vbCrLf & "It has been in " & (i) & " times"
Web.Mail.SmtpMail.SmtpServer = "Server name" set the server
Web.Mail.SmtpMail.Send(mailMsg) send it

End If
End While
GlobalConn.Close()
 
Back
Top