Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 25
  1. #1

    inserimento di news "lunghe"

    Ciao!!!!
    ho creato un form per inserire delle news in un altra pagina del sito. questo form è collegato a un database, che è collegato alla pagina dove vengono visualizzate le news aggiunte. però siccome aggiungo delle news abbastanza lunghe(quindi devo premere invio per andare a capo e distanziare un pò le varie informazioni contenute nella stessa news)mi da questo errore!

    Si sono verificati errori in un'operazione OLE DB composta da più passaggi. Controllare i singoli valori di stato OLE DB, se disponibili. Nessuna operazione eseguita.

    il form è composto da due semplicissimi campi: titolo e testo.
    ho provato a inserire qualche riga di news (senza premere invio) e mi funziona, mi viene visualizzato tutto correttamente.
    come posso fare per far sì che posso inserire delle news lunghe potendo premere invio?

    grazieeeeeeee 1000!!!!!!!!!!!!
    ciaooooooo

  2. #2
    A parte che magari se ci facessi vedere un po di codice sarebbe meglio.
    Comunque, secondo me è perchè usi un campo di tipo TESTO. Prova a farlo di tipo MEMO.

  3. #3
    ciao!!
    allora...questo è il codice che uso per connettermi al db e visualizzare i risultati sul sito
    <%
    dim conn
    Set conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& server.MapPath("/directory/db.mdb")
    Set RS = Server.CreateObject("ADODB.Recordset")
    RS.ActiveConnection = Conn
    RS.Open "SELECT * FROM tabella"
    %>
    </tr>
    <%
    WHILE NOT RS.EOF
    %>
    <tr>
    <td align="center" style="border-style: none; border-width: medium"><font face="Century Gothic" color="#FFFFFF"><%=rs("title")%></font></td>
    </tr>
    <tr>
    <td align="justify" style="border-style: none; border-width: medium"><font face="Verdana" size="2" color="#FFFFFF"><%=rs("text")%></font></td>
    </tr>
    <%
    RS.MoveNext()
    WEND
    %>
    e questo è il codice asp che mi invia il modulo al db:
    <%
    title = request.form("title")
    text = request.form("text")

    dim strCode
    strCode="innovatel"

    dim conn
    Set conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& server.MapPath("/directory/db.mdb")
    sql = "SELECT * FROM tabella"
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open "tabella",conn,3,3

    rs.addnew
    rs("title") = title
    rs("text") = text
    rs.update

    rs.Close
    set rs = Nothing
    conn.Close
    set conn = Nothing
    %>


    questo è il codice del modulo text
    <td style="border-style: none; border-width: medium" width="614">
    <textarea rows="15" name="text" cols="61"></textarea></td>

    il campo di tipo memo??come si fa di tipo memo?devo cambiare textarea?

    grazieeeeeeeeeeeeeeeeee

  4. #4
    il tipo di campo si imposta in access...

  5. #5
    okkkk!!
    grazieeeee!!!ora riesco a scrivere news abbastanza lunghe....!
    solo che ho un altro problema: anche se nel modulo scrivo la news distanziando delle notizie premendo invio, quando mi viene visualizzato nella pagina con le news, quello che avevo scritto è tutto attaccato.
    mi spiego meglio.
    se io digito nell area del modulo:

    NOTIZIA1:
    blablablablablabla.............


    NOTIZIA2:
    DATA:
    blablablabla

    mi viene visualizzata così:

    NOTIZIA1:blablablablablabla.............NOTIZIA2ATA:blablablabla
    senza tener conto delle separazioni che ho fatto.

    come posso risolvere questo???

  6. #6
    Quando leggi dal db per visualizzare le news fai così:
    codice:
    testoNews = rs("campoDB")
    testoNews = replace(testoNews,vbCrLf,"
    ")
    response.write testoNews

  7. #7
    siiiiiiiiiiiiiiii!!!!!!
    grazieeeeeeeeeeeeee!!!!!!

    ho inserito questa parte di script che mi hai scritto sopra nel codice che mi visualizza le news sulla pagina del sito.

    tutto ok!!!!!

    grazie ancora!!!
    ciaooooooooooooooo

  8. #8
    salve, anche io ho lo stesso problema, ma non funziona,
    cosa ho sbagliato?


    questo è il codice:


    <%
    ' RICHIEDE L'ID
    ID = Request("ID")

    ' SE NON E' STATO PASSATO UN VALORE VALIDO
    ' COME ID, IMPOSTA QUESTO AD UNO
    If not ISNumeric(ID) or Len(ID) = 0 Then
    ID = 1
    End IF

    ' SE L'ID E' UGUALE A ZERO
    ' LO IMPOSTA UGUALE A UNO
    IF ID = 0 Then
    ID = 1
    End IF

    ' PERCORSO DEL DATABASE
    url_DB = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("/mdb-database/database.mdb")

    Set Conn = Server.CreateObject("ADODB.Connection")
    conn.Open url_DB

    Set RecSet = Server.CreateObject("ADODB.Recordset")

    ' PRELEVA LA NEWS DAL DB, IN BASE ALL'ID PASSATO

    SQL = "SELECT * FROM NEWS WHERE ID = " & ID &""
    RecSet.Open SQL, Conn, adOpenStatic, adLockOptimistic


    ' CONTROLLA SE LA NEWS E' REALMENTE PRESENTE
    If RecSet.Eof = False Then


    ' VISUALIZZA LA NEWS, PRELEVANDO DAL DB I VARI CONTENUTI (TITOLO, DATA, AUTORE, ECC...):


    %>



    <font face="Verdana" size="4">&gt; <%=RecSet("titolo")%> </font><font face="Verdana" size="2">di
    <%=RecSet("autore")%>
    - <%=RecSet("data")%></font></p>


    <font face="Verdana" size="2">
    <%
    testoNews = recset("contenuto")
    testoNews = replace(testoNews,vbCrLf,"
    ")
    response.write testoNews
    %>

    </font></p>


    </p>
    <%
    End IF

    RecSet.Close
    Conn.Close
    Set Conn = Nothing
    Set RecSet = Nothing
    %>

  9. #9
    Originariamente inviato da clara
    salve, anche io ho lo stesso problema, ma non funziona,
    cosa ho sbagliato?


    questo è il codice:


    <%
    ' RICHIEDE L'ID
    ID = Request("ID")

    ' SE NON E' STATO PASSATO UN VALORE VALIDO
    ' COME ID, IMPOSTA QUESTO AD UNO
    If not ISNumeric(ID) or Len(ID) = 0 Then
    ID = 1
    End IF

    ' SE L'ID E' UGUALE A ZERO
    ' LO IMPOSTA UGUALE A UNO
    IF ID = 0 Then
    ID = 1
    End IF

    ' PERCORSO DEL DATABASE
    url_DB = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("/mdb-database/database.mdb")

    Set Conn = Server.CreateObject("ADODB.Connection")
    conn.Open url_DB

    Set RecSet = Server.CreateObject("ADODB.Recordset")

    ' PRELEVA LA NEWS DAL DB, IN BASE ALL'ID PASSATO

    SQL = "SELECT * FROM NEWS WHERE ID = " & ID &""
    RecSet.Open SQL, Conn, adOpenStatic, adLockOptimistic


    ' CONTROLLA SE LA NEWS E' REALMENTE PRESENTE
    If RecSet.Eof = False Then


    ' VISUALIZZA LA NEWS, PRELEVANDO DAL DB I VARI CONTENUTI (TITOLO, DATA, AUTORE, ECC...):


    %>



    <font face="Verdana" size="4">&gt; <%=RecSet("titolo")%> </font><font face="Verdana" size="2">di
    <%=RecSet("autore")%>
    - <%=RecSet("data")%></font></p>


    <font face="Verdana" size="2">
    <%
    testoNews = recset("contenuto")
    testoNews = replace(testoNews,vbCrLf,"
    ")
    response.write testoNews
    %>

    </font></p>


    </p>
    <%
    End IF

    RecSet.Close
    Conn.Close
    Set Conn = Nothing
    Set RecSet = Nothing
    %>
    Che errore ti da?

  10. #10

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.