I have what may be a newbie question: I am using a label to show status messages. Things like, click an update button, a db update happens, and then the label.text is set to "update complete."
I want to set the label text BEFORE a long query runs to say something like "Processing, please wait..."
The problem is that any me.label.text = statement I put before opening the connection and running a query seems to be ignored. I can set the label text after the query finishes, but not before. A simple example is below:
Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click
Me.label.text = "Processing, please wait..."
Dim cn As New SqlConnection(Application("cnString"))
Dim cmd As New SqlCommand
cmd.CommandText = "Stored_Procedure"
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandTimeout = 2000 'long running query
cmd.Connection = cn
cn.Open()
cmd.ExecuteNonQuery()
cn.Close()
Me.label.Text = "Process complete."
End Sub
What am I missing, here? Thanks in advance!
Jason
I want to set the label text BEFORE a long query runs to say something like "Processing, please wait..."
The problem is that any me.label.text = statement I put before opening the connection and running a query seems to be ignored. I can set the label text after the query finishes, but not before. A simple example is below:
Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click
Me.label.text = "Processing, please wait..."
Dim cn As New SqlConnection(Application("cnString"))
Dim cmd As New SqlCommand
cmd.CommandText = "Stored_Procedure"
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandTimeout = 2000 'long running query
cmd.Connection = cn
cn.Open()
cmd.ExecuteNonQuery()
cn.Close()
Me.label.Text = "Process complete."
End Sub
What am I missing, here? Thanks in advance!
Jason