in un database access ho fatto un campo di tipo memo e ci inserisco
del testo tipo un racconto o una poesia ecc.
quando vado ad estrarre il record mi stampa a video tutto bene solo che le righe di testo non vanno a capo come sono scritte nel campo del database ma riempiono la cella html sconvolgendo il senso del testo scritto.
Come faccio per far andare a capo il testo quando va a capo nel database?
potete vedere un'esempio qui:
http://www.essevueffe.it/irideverde/default.asp
questo è il codice della pagina:
<%@LANGUAGE="VBSCRIPT"%>
<html>
<head>
<title>Documento senza titolo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="tema.css" rel="stylesheet" type="text/css">
</head>
<%
Sub Pagina()
Dim RS
%>
<body>
<table width="765" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="40" rowspan="2" valign="top"></td>
<td width="397" height="36"></td>
<td width="141"></td>
<td width="187"></td>
</tr>
<tr>
<td height="18" valign="top" class="txt-12-nero">I miei scritti divisi per
categoria </td>
<td valign="top" class="txt-12-nero"> <div align="center"><%= Date()%> </div></td>
<td></td>
</tr>
<tr>
<td height="19" colspan="4" valign="top"></td>
</tr>
<tr>
<%'............................................... ......nessuna categoria scelta
If Request("cat") = "" Then
Set RS = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT DISTINCT categoria FROM testi ORDER by categoria ASC"
iniz_cat='"&cat1&"' ORDER by categoria ASC"
RS.Open SQL, Conn, adOpenStatic, adLockOptimistic
%>
<td height="70" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="577" height="20" valign="top" class="txt-14B-nero">Categorie</td>
<td width="188"></td>
</tr>
<tr>
<td height="20" colspan="2" valign="top"></td>
</tr>
<tr>
<td height="30" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<% Do while Not RS.Eof %>
<td width="382" height="30" valign="top" class="txt-12-nero">" class="txt-12-nero"><%=RS("categoria")%></td>
<%
RS.MoveNext
If Not RS.Eof Then
%>
<td width="383" valign="top" class="txt-12-nero">" class="txt-12-nero"><%=RS("categoria")%></td>
</tr>
<%
RS.MoveNext
End If
Loop
RS.Close
Set RS = Nothing
%>
</table></td>
</tr>
</table></td>
<% Else %>
<%'............................................... ......estrazione dei titoli per la categoria
cat = replace(request("cat"), "'", "''")
If Request("id") = "" Then
Set RS = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM testi WHERE categoria = '"&cat&"' ORDER by titolo ASC"
RS.Open SQL, Conn, adOpenStatic, adLockOptimistic
%>
</tr>
<tr>
<td height="70" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="577" height="20" valign="top" class="txt-14B-nero">Categorie</td>
<td width="188"></td>
</tr>
<tr>
<td height="20" colspan="2" valign="top"></td>
</tr>
<tr>
<td height="30" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<% Do while Not RS.Eof %>
<tr>
<td width="382" height="30" valign="top" class="txt-12-nero">" class="txt-12-nero"><%=RS("titolo")%></td>
<%
RS.MoveNext
If Not RS.Eof Then
%>
<td width="383" valign="top" class="txt-12-nero">" class="txt-12-nero"><%=RS("titolo")%></td>
</tr>
<%
RS.MoveNext
End If
Loop
RS.Close
Set RS = Nothing
%>
</table></td>
</tr>
</table>
<%
End If
'Else
%> </td>
</tr>
<tr>
<td height="95" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<%'............................................... ......estrazione del testo
If Request("id") <> "" Then
id = Request("id")
Set RS = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM testi WHERE id = "&Request("id")&""
RS.Open SQL, Conn, adOpenStatic, adLockOptimistic
%>
<tr>
<td height="20" colspan="3" valign="top">Categorie
- Titoli</td>
</tr>
<tr>
<td height="30" colspan="3" valign="top"><div align="center" class="txt-14B-nero"><%=RS("titolo")%> </div></td>
</tr>
<tr>
<td height="25" colspan="3" valign="top" class="txt-10-nero"> <div align="center">di
- <span class="txt-10B-nero"><%=RS("autore")%></span></div></td>
</tr>
<tr>
<td width="75" height="20"></td>
<td width="590" valign="top" class="txt-12-nero"><%=RS("testo")%></td>
<td width="100"></td>
</tr>
</table></td>
</tr>
<%
Else
'Response.Redirect "racconti.asp"
End If
End If
%>
</table>
</body>
</html>
<% End Sub %>




Rispondi quotando
