Click here to Skip to main content
15,905,144 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Diff betn ExecuteNonQuery & ExecuteScalar Pin
ne0h21-Feb-06 22:35
ne0h21-Feb-06 22:35 
GeneralRe: Diff betn ExecuteNonQuery & ExecuteScalar Pin
mayhem_rules22-Feb-06 1:08
mayhem_rules22-Feb-06 1:08 
Questionhow to add custom control to treeview nodes Pin
kondepudi nagaraju21-Feb-06 19:26
kondepudi nagaraju21-Feb-06 19:26 
QuestionSend Sms via mobile connected to Pc in vb6.0 Pin
bmano21-Feb-06 18:52
bmano21-Feb-06 18:52 
QuestionHandling keyboard "special" buttons Pin
Syberaptor21-Feb-06 17:08
Syberaptor21-Feb-06 17:08 
AnswerRe: Handling keyboard "special" buttons Pin
progload21-Feb-06 18:32
progload21-Feb-06 18:32 
GeneralRe: Handling keyboard "special" buttons Pin
Syberaptor22-Feb-06 7:39
Syberaptor22-Feb-06 7:39 
Questionwhen does the Sub application_start know when to start? Pin
kenn_rosie21-Feb-06 15:05
kenn_rosie21-Feb-06 15:05 
I have built the following code in my global.asax code

My question is how and when does the Sub application_start know when to start?
What must I do to trigger it to start and send an email?



Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
myConnection.Open()
'2. Create the command object, for the query
Const strSQL As String = "Select LastUpdated, ProductId from products "
Dim objCmd As New SqlCommand(strSQL, myConnection)
Dim objDR As SqlDataReader
objDR = objCmd.ExecuteReader()
While (objDR.Read)
'look the code is looking for DATETIME .. but it found NULL values
'need this code to keep from getting errors if a null is found
'we need to put some check for nulls
If (Not (objDR("LastUpdated") Is DBNull.Value)) Then

If (Date.Compare(objDR("LastUpdated"), Today.Date) = 0) Then
Dim newMail As New MailMessage
newMail.From = "from@from.com" '' this is the From Address
newMail.To = "kenn_rosie@msn.com" '' this is TO Address
newMail.Subject = "Change in Product Rate"
newMail.Body = " Dear Ken, " & _
"Please review attached email for product ID: " & objDR("ProductID") & _
"Thank you," & _
"Kenn()"
End If
End If

End While
myConnection.Close() 'Close the connection

End Sub
AnswerRe: when does the Sub application_start know when to start? Pin
Christian Graus21-Feb-06 15:51
protectorChristian Graus21-Feb-06 15:51 
GeneralRe: when does the Sub application_start know when to start? Pin
kenn_rosie21-Feb-06 17:15
kenn_rosie21-Feb-06 17:15 
GeneralRe: when does the Sub application_start know when to start? Pin
Christian Graus21-Feb-06 17:17
protectorChristian Graus21-Feb-06 17:17 
GeneralRe: when does the Sub application_start know when to start? Pin
kenn_rosie21-Feb-06 18:05
kenn_rosie21-Feb-06 18:05 
GeneralRe: when does the Sub application_start know when to start? Pin
Divya Rathi22-Feb-06 3:48
Divya Rathi22-Feb-06 3:48 
QuestionDetect the file is opened or not? Pin
cylix200021-Feb-06 14:49
cylix200021-Feb-06 14:49 
AnswerRe: Detect the file is opened or not? Pin
Christian Graus21-Feb-06 15:51
protectorChristian Graus21-Feb-06 15:51 
GeneralRe: Detect the file is opened or not? Pin
cylix200021-Feb-06 16:29
cylix200021-Feb-06 16:29 
GeneralRe: Detect the file is opened or not? Pin
Christian Graus21-Feb-06 16:30
protectorChristian Graus21-Feb-06 16:30 
AnswerRe: Detect the file is opened or not? Pin
japel21-Feb-06 18:32
japel21-Feb-06 18:32 
QuestionWhat object is streamwriter located under? Pin
kenn_rosie21-Feb-06 13:00
kenn_rosie21-Feb-06 13:00 
AnswerRe: What object is streamwriter located under? Pin
progload21-Feb-06 13:37
progload21-Feb-06 13:37 
GeneralRe: What object is streamwriter located under? Pin
kenn_rosie21-Feb-06 13:49
kenn_rosie21-Feb-06 13:49 
GeneralRe: What object is streamwriter located under? Pin
progload21-Feb-06 14:36
progload21-Feb-06 14:36 
GeneralRe: What object is streamwriter located under? Pin
kenn_rosie21-Feb-06 14:51
kenn_rosie21-Feb-06 14:51 
QuestionServer & Client Pin
ADY00721-Feb-06 12:25
ADY00721-Feb-06 12:25 
QuestionCreateObject("WindowsInstaller.Installer") Error Pin
Sysdoc262821-Feb-06 12:18
Sysdoc262821-Feb-06 12:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.