N
NN
Hello, I have a problem
I have a webform in which I have the event Onload that refers to a script
that find in a database for an image and then show it in the WebForm. The
problem is that I want to repeat the search automatically every 5 seconds. I
Already tried with <meta http-equiv="refresh" content="5"/> but if i having
the OnLoad in the form, does not do anything, does not refresh. I don't know
what to do : (
I hope that someone could help, for the doubts I pass the code of the
script. Thank you very much!
<script runat="server">
Public Sub MostrarImagen(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim cadena As String = "Database=vigilancia;DataSource=localhost;User
Id=root;password=vigilancia"
Dim query As String = "Select * from imagenes"
Dim conn As New MySqlConnection(cadena)
Dim da As New MySqlDataAdapter(query, conn)
Dim ds As New DataSet
conn.Open()
da.Fill(ds, "Vigilancia")
Dim contador As Integer
contador = ds.Tables("Vigilancia").Rows.Count
Dim myRow As DataRow
myRow = ds.Tables("Vigilancia").Rows(contador - 1)
Dim myData() As Byte
myData = myRow("imagen")
Response.Buffer = True
Response.ContentType = "Image/JPEG"
Response.BinaryWrite(myData)
End Sub
</script>
I have a webform in which I have the event Onload that refers to a script
that find in a database for an image and then show it in the WebForm. The
problem is that I want to repeat the search automatically every 5 seconds. I
Already tried with <meta http-equiv="refresh" content="5"/> but if i having
the OnLoad in the form, does not do anything, does not refresh. I don't know
what to do : (
I hope that someone could help, for the doubts I pass the code of the
script. Thank you very much!
<script runat="server">
Public Sub MostrarImagen(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim cadena As String = "Database=vigilancia;DataSource=localhost;User
Id=root;password=vigilancia"
Dim query As String = "Select * from imagenes"
Dim conn As New MySqlConnection(cadena)
Dim da As New MySqlDataAdapter(query, conn)
Dim ds As New DataSet
conn.Open()
da.Fill(ds, "Vigilancia")
Dim contador As Integer
contador = ds.Tables("Vigilancia").Rows.Count
Dim myRow As DataRow
myRow = ds.Tables("Vigilancia").Rows(contador - 1)
Dim myData() As Byte
myData = myRow("imagen")
Response.Buffer = True
Response.ContentType = "Image/JPEG"
Response.BinaryWrite(myData)
End Sub
</script>