[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

SuperNess

6/27/2006 2:42:00 PM

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>


1 Answer

Sazid Khan

8/27/2006 5:31:00 PM

0


NN,

If i get u right, u want 2 reload the image every 5 seconds. as u mentioned,
use meta refresh tag and write the code for binding the image in the page
code-behind file *.vb or *.cs (why 2 go for a script).

if i get it wrong, try 2 paste the compelte code n urs requirements in more
detail. i can help u out.

Thanks,
Sazid.

"NN" wrote:

> 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>
>
>
>