E
Elizabeth Harmon
hi All,
I dont know if this is possible, so i am asking
Is there a Way to monitor a connection when it is fetching on a web page? I
am providing a status Bar and process to my users so they can see something
is happening?
I would like to do a while loop as in
i+=1
Do while ConnectionState.Fetching
WriteStatusUpdate(writer, "Fetching Records ..." & i.toString(), true)
i+=1
loop
I am currently using the Protected OverRide Render writer to show status,
and would like a little more detail?
Any Suggestions Grealt Appreciated, If you need to review the code, while
lenghty, may help some one else. Code as Follows:
thanks in advance
Smantha
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Dim strmsg As String = ""
' Call the parent render and then flush the contents to get them to the
browser quickly
MyBase.Render(writer)
writer.Flush()
Response.Flush()
' Check to see if btnClear was clicked and that's why we're rendering
If boolStartEvent Then
' Send a "starting operation" message
WriteStatusUpdate(writer, "Checking Connection ...", False)
' Do your long running operation here - provide status at will
Dim TimerEnd As Long = Now().Ticks + 100000000
While Now().Ticks <= TimerEnd
End While
If IsPostBack Then
strmsg = checkConnection()
End If
If blnConnectFound = True Then
WriteStatusUpdate(writer, "Found. Proceeding With Update,Please Wait.",
True)
writer.Flush()
Response.Flush()
chkConn = New SqlConnection
chkConn.ConnectionString = ConfigurationSettings.AppSettings("SqlServer")
Try
chkConn.Open()
cmdSql.Connection = chkConn
cmdSql.CommandType = CommandType.StoredProcedure
cmdSql.CommandText = "csp_INSERT_Get_Member_Info"
cmdSql.ExecuteNonQuery()
*************************************************
Would like to Monitor thread here if Possible?
*************************************************
chkConn.Close()
chkConn.Dispose()
chkConn = Nothing
cmdSql = Nothing
WriteStatusUpdate(writer, "Update Completed. Please Click Find a Patient.",
True)
writer.Flush()
Response.Flush()
Exit Sub
Catch ex As Exception
WriteStatusUpdate(writer, "Connection to DB not Available because." & "<BR>"
& ex.Message, True)
writer.Flush()
Response.Flush()
chkConn.Close()
chkConn.Dispose()
chkConn = Nothing
cmdSql = Nothing
End Try
End If
statBar.Style.Clear()
statBar.Style.Add("display", "none")
Response.Flush()
' Clear flag
boolStartEvent = False
Response.Flush()
End If
End Sub
Private Sub WriteStatusUpdate(ByVal writer As System.Web.UI.HtmlTextWriter,
ByVal Status As String, ByVal NewLine As Boolean)
If NewLine Then
writer.Write _
(String.Format("<script
language=""javascript"">document.all[""updatingGif""].innerHTML +=
""{0}<br>"";</script>", Status))
Else
writer.Write _
(String.Format("<script
language=""javascript"">document.all[""updatingGif""].innerHTML +=
""{0}"";</script>", Status))
End If
writer.Flush()
Response.Flush()
End Sub
I dont know if this is possible, so i am asking
Is there a Way to monitor a connection when it is fetching on a web page? I
am providing a status Bar and process to my users so they can see something
is happening?
I would like to do a while loop as in
i+=1
Do while ConnectionState.Fetching
WriteStatusUpdate(writer, "Fetching Records ..." & i.toString(), true)
i+=1
loop
I am currently using the Protected OverRide Render writer to show status,
and would like a little more detail?
Any Suggestions Grealt Appreciated, If you need to review the code, while
lenghty, may help some one else. Code as Follows:
thanks in advance
Smantha
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Dim strmsg As String = ""
' Call the parent render and then flush the contents to get them to the
browser quickly
MyBase.Render(writer)
writer.Flush()
Response.Flush()
' Check to see if btnClear was clicked and that's why we're rendering
If boolStartEvent Then
' Send a "starting operation" message
WriteStatusUpdate(writer, "Checking Connection ...", False)
' Do your long running operation here - provide status at will
Dim TimerEnd As Long = Now().Ticks + 100000000
While Now().Ticks <= TimerEnd
End While
If IsPostBack Then
strmsg = checkConnection()
End If
If blnConnectFound = True Then
WriteStatusUpdate(writer, "Found. Proceeding With Update,Please Wait.",
True)
writer.Flush()
Response.Flush()
chkConn = New SqlConnection
chkConn.ConnectionString = ConfigurationSettings.AppSettings("SqlServer")
Try
chkConn.Open()
cmdSql.Connection = chkConn
cmdSql.CommandType = CommandType.StoredProcedure
cmdSql.CommandText = "csp_INSERT_Get_Member_Info"
cmdSql.ExecuteNonQuery()
*************************************************
Would like to Monitor thread here if Possible?
*************************************************
chkConn.Close()
chkConn.Dispose()
chkConn = Nothing
cmdSql = Nothing
WriteStatusUpdate(writer, "Update Completed. Please Click Find a Patient.",
True)
writer.Flush()
Response.Flush()
Exit Sub
Catch ex As Exception
WriteStatusUpdate(writer, "Connection to DB not Available because." & "<BR>"
& ex.Message, True)
writer.Flush()
Response.Flush()
chkConn.Close()
chkConn.Dispose()
chkConn = Nothing
cmdSql = Nothing
End Try
End If
statBar.Style.Clear()
statBar.Style.Add("display", "none")
Response.Flush()
' Clear flag
boolStartEvent = False
Response.Flush()
End If
End Sub
Private Sub WriteStatusUpdate(ByVal writer As System.Web.UI.HtmlTextWriter,
ByVal Status As String, ByVal NewLine As Boolean)
If NewLine Then
writer.Write _
(String.Format("<script
language=""javascript"">document.all[""updatingGif""].innerHTML +=
""{0}<br>"";</script>", Status))
Else
writer.Write _
(String.Format("<script
language=""javascript"">document.all[""updatingGif""].innerHTML +=
""{0}"";</script>", Status))
End If
writer.Flush()
Response.Flush()
End Sub