Visualizzazione dei risultati da 1 a 10 su 10

Discussione: for vs repeater e soci

  1. #1
    Utente di HTML.it L'avatar di Francis87
    Registrato dal
    Jun 2003
    Messaggi
    5,970

    for vs repeater e soci

    è possibile fare un ciclo for ke, prendendo i primi tre records da un DB ordinati secondo un campo, me li stampi fuori tranquillamente?

    asp:repeater, asp:datalist e asp:datagrid mi han distrutto il layout!!!

    se si può, come devo fare?
    grazie 10000

    ciao ciao

    Heaven's closed. Hell sold out.

    Linux 2.6.26-2-amd64
    Debian squeeze

  2. #2
    query....

    while objreader.read
    response.write(objreader("tuo_campo"))
    wend

    lo piazzi nel page_load o lo richiami in qualche modo.

  3. #3
    Utente di HTML.it L'avatar di Francis87
    Registrato dal
    Jun 2003
    Messaggi
    5,970
    Originariamente inviato da Daniele80
    query....

    while objreader.read
    response.write(objreader("tuo_campo"))
    wend

    lo piazzi nel page_load o lo richiami in qualche modo.
    quindi posso fare


    while objreader.read
    response.write("<tr><td>&middot;" & objreader("tuo_campo") & "</td></tr>")
    wend


    ?
    codice:
     Dim cn As OleDbConnection
     Dim cnstr, sqlstr As String
     cnstr = "Provider=Microsoft.Jet.OLEDB.4.0; " _
      + "Data Source=c:\\hosting\\noidellac.it\\wwwroot\\mdb-database\\prova.mdb"
     sqlstr = "SELECT TOP 3 ID, nome, numero FROM visitatori ORDER BY numero DESC"
     cn = New OleDbConnection(cnstr)
     cn.Open()
    quale sarebbe il mio objreader o con cosa lo rimpiazzo o dove lo aggiungo??


    Heaven's closed. Hell sold out.

    Linux 2.6.26-2-amd64
    Debian squeeze

  4. #4
    dim objReader as OleDbeader

    Set objReader = con.Execute("SELECT * FROM tb")

    while objreader.read
    response.write("<tr><td>·" & objreader("tuo_campo") & "</td></tr>")
    wend

  5. #5
    Utente di HTML.it L'avatar di Francis87
    Registrato dal
    Jun 2003
    Messaggi
    5,970

    Type 'OleDbReader' is not defined

    Dim objReader As OleDbReader



    io importo

    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb" %>
    Heaven's closed. Hell sold out.

    Linux 2.6.26-2-amd64
    Debian squeeze

  6. #6

  7. #7

  8. #8
    Utente di HTML.it L'avatar di Francis87
    Registrato dal
    Jun 2003
    Messaggi
    5,970

    Input string was not in a correct format.

    cosa significa?

    codice:
     Dim cn As OleDbConnection
     Dim objReader As OleDbDataReader
     Dim cnstr, sqlstr As String
     cnstr = "Provider=Microsoft.Jet.OLEDB.4.0; " _
      + "Data Source=c:\\hosting\\noidellac.it\\wwwroot\\mdb-database\\visitppers.mdb"
     sqlstr = "SELECT TOP 3 ID, nome, numero FROM visitatori ORDER BY numero DESC"
     cn = New OleDbConnection(cnstr)
     cn.Open()
     Dim objCommand As New OleDbCommand(sqlstr, cn)
     ObjReader = objCommand.ExecuteReader(sqlstr)
     While ObjReader.Read
      Response.write("<tr><td class=""tab3"">" & ObjReader("nome") & "</td></tr>") 
     End While 
     cn.Close()

    Heaven's closed. Hell sold out.

    Linux 2.6.26-2-amd64
    Debian squeeze

  9. #9

    Re: Input string was not in a correct format.

    Originariamente inviato da Francis87
    cosa significa?

    codice:
     Dim cn As OleDbConnection
     Dim objReader As OleDbDataReader
     Dim cnstr, sqlstr As String
     cnstr = "Provider=Microsoft.Jet.OLEDB.4.0; " _
      + "Data Source=c:\\hosting\\noidellac.it\\wwwroot\\mdb-database\\visitppers.mdb"
     sqlstr = "SELECT TOP 3 ID, nome, numero FROM visitatori ORDER BY numero DESC"
     cn = New OleDbConnection(cnstr)
     cn.Open()
     Dim objCommand As New OleDbCommand(sqlstr, cn)
     ObjReader = objCommand.ExecuteReader(sqlstr)
     While ObjReader.Read
      Response.write("<tr><td class=""tab3"">" & ObjReader("nome") & "</td></tr>") 
     End While 
     cn.Close()

    in che riga ti viene dato? ...poi soprattutto io eviterei di usare il response.write...lo sconsigliano per asp.net...meglio un controllo litteral
    "I video giochi non influenzano i bambini. Voglio dire, se Pac-man avesse influenzato la nostra generazione, staremmo tutti saltando in sale scure, masticando pillole magiche e ascoltando musica elettronica ripetitiva!" (Kristian Wilson, Nintendo Inc., 1989)
    Pochi anni dopo naquero le feste rave, la musica techno e l'ecstasy...

    :quote:

  10. #10
    Utente di HTML.it L'avatar di Francis87
    Registrato dal
    Jun 2003
    Messaggi
    5,970
    Line 185: ObjReader = objCommand.ExecuteReader(sqlstr)

    ma credo possa interessare anke la sqlstr
    Heaven's closed. Hell sold out.

    Linux 2.6.26-2-amd64
    Debian squeeze

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.