kun første 60 bogstaver af felt skal vises
Hej !2 spgm.
1.
Mit felt 'nyhed' skal der kun vises de første fx 60 bogstaver af. Hvordan gør jeg det ?
2.
Er det ligemeget om jeg laver en response.write ("felt")
eller om jeg skrive <%=felt%>
Er det ene bedre frem for det andet ?
<% Session.LCID=1030 %>
<html>
<head>
<title>View_nyheder</title>
<link rel="stylesheet" type="text/css" href="fiskestil.css">
</head>
<body bgcolor="#F9F9F9" text="black">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="530" id="AutoNumber2">
<tr>
<td width="100%">
<p align="center">
<font face="Verdana" size="2">
<strong>
Nyheder </strong></font></p>
</td>
</tr>
<tr>
<td width="100%" style="border-bottom-style: none; border-bottom-width: medium">
<hr width="530px">
</td>
</tr>
<tr>
<td width="100%" class="menutekst" style="border-style: none; border-width: medium" align=right>
<a href="indtast_nyhed.asp">Indsend nyhed</a>
</td>
</tr>
</table>
</center>
</div>
<br>
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../db/nyheder.mdb")
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT nyhedstabel.* FROM nyhedstabel order by dato desc;"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
'Loop through the recordset
Do While not rsGuestbook.EOF
%>
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" style="border-width:0px; border-collapse: collapse" width="530px" bordercolor="#000000">
<tr>
<td class="brodtekst" style="border-style: none; border-width: medium"><%=rsguestbook("overskrift")%></td>
<td class="menutekst" align="right" style="border-style: none; border-width: medium"><%=rsguestbook("dato")%> <%=rsguestbook("tid")%></td>
</tr>
<tr>
<td colspan="2" class="menutekst" style="border-style: none; border-width: medium">Indsendt af: <%=rsguestbook("forfatter")%></td>
</tr>
<tr>
<td colspan="2"class="menutekst" style="border-style: none; border-width: medium">Kilde: <a href="<%=rsguestbook("kilde")%>" target="_blank"><%=rsguestbook("kilde")%></a></td>
</tr>
<tr>
<td colspan="2"class="brodtekst" style="border-style: none; border-width: medium"><%=rsguestbook("nyhed")%></td>
</tr>
<tr>
<td colspan="2"class="brodtekst" style="border-style: none; border-width: medium">
<%
Response.Write ("<a href=""view_selected.asp?ID=" & rsGuestbook("ID_no") & """>")
Response.Write ("Læs mere")
Response.Write ("</a>")
%>
</td>
</tr>
</table>
</div>
<hr style="border-style: dotted; border-width: 1px" size="1" width="530px" color="#000000">
<%
'Move to the next record in the recordset
rsGuestbook.MoveNext
Loop
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
</body>
</html>
