Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Label refreshing problem

Status
Not open for further replies.

Malchik

Programmer
Dec 8, 2001
148
CA
Hi,
I need to show a description of an operation in a label while an SQL DTS and stored proc are launched. The SQL part works fine, but my label do not show the text. In VB6 this problem can be worked around by using REFRESH of DOEVENTS. How can I reach the same in .NET. Below is part of the code to give you an example:



Protected Sub ProcessStatFile()
Dim CnnCol As ConnectionStringSettingsCollection
Dim sCnn As String
Dim SQLcnn As New SqlClient.SqlConnection
Dim SQLcmd As SqlClient.SqlCommand

If Session("LNG") = "1" Then
lblMsg.Text = "Validation des employés"
Else
lblMsg.Text = "Employees Validation"
End If

'Get the ODBC configuration from the Web.Config
CnnCol = ConfigurationManager.ConnectionStrings
sCnn = CnnCol.Item("IntranetConnection").ToString

SQLcnn.ConnectionString = sCnn
SQLcnn.Open()

SQLcmd = New SqlClient.SqlCommand
SQLcmd.CommandText = "sp_StandardizeImportTable"
SQLcmd.CommandType = CommandType.StoredProcedure
SQLcmd.Connection = SQLcnn
SQLcmd.ExecuteNonQuery()

If Session("LNG") = "1" Then
lblMsg.Text = "Mise à jour des statistiques"
Else
lblMsg.Text = "Update statistics"
End If
SQLcmd = New SqlClient.SqlCommand
SQLcmd.CommandText = "sp_UpdateEmployeeStats"
SQLcmd.CommandType = CommandType.StoredProcedure
SQLcmd.Connection = SQLcnn

SQLcmd.ExecuteNonQuery()

SQLcmd = Nothing
SQLcnn = Nothing


If Session("LNG") = "1" Then
lblMsg.Text = "Opération terminée!"
Else
lblMsg.Text = "Operation completed!"
End If
End Sub


Only the last message (Operation Completed) is shown, probably because the process has been released...

Thanks for your help.

Mal'chik [bigglasses]
 
I t has nothing to do with your processing but how the page renders in asp.net. When you sub runs it sets the labes calls a sql command sets the label calls another sql command and sets the label again. You are always going to see the last message only. Web applications work differently than Windows applications. In a web app, all processing is done, then the page is rendered. In order to show different status, you would either have to create separate pages that do each individual sql call and display a message or you need to use AJAX.
 
It has nothing to do with your processing but how the page renders in asp.net. When you sub runs it sets the labes calls a sql command sets the label calls another sql command and sets the label again. You are always going to see the last message only. Web applications work differently than Windows applications. In a web app, all processing is done, then the page is rendered. In order to show different status, you would either have to create separate pages that do each individual sql call and display a message or you need to use AJAX.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top