I found a solution which worked. Thank you very much for your contribution and help.
In "Connect.asp" i connect to database and create recordset for which i use later on.
The document "notes.asp" gets the info needed through a cookie coming from elsewhere. This data is handled same place and not shown as this contains info not for public display :)
In the left section i create input for the SQL database. Most fields are readonly for the user as the input comes from the cookie and time.
The notes for the same tagname is shown in the right sections textarea.
This data can also be printed (in an unordered way).
I'll post my code below, but not CSS. The VBs might be unordered but works like a charm.
Connect.asp:
<% 'include file
dim strConnect,objConn,objRecordSet
Set objConn = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objConn.Open = "Provider=SQLOLEDB;Server=.\SQLEXPRESS;" & _
"Database=HISTORICDATA;User ID=sa;Password=PW;"
%>
<!-- METADATA TYPE="typelib"
FILE="C:\Program Files (x86)\Common Files\System\ado\msado15.dll" -->
From my "notes.asp":
<%@ Language="VBScript" %>
<!-- #include file="connect.asp" -->
<!-- Cookie handling -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/styles.css" type="text/css" />
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<![endif]-->
<script language="javascript">
<!--
function printTextArea(notetxtarea)
{
var elementRef = document.getElementById(notetxtarea);
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');
printWindow.document.write(elementRef.value);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
// -->
</script>
<title>Notes for <% response.write(tagname) %></title>
</head>
<body onload="window.resizeTo(1000,900)">
<header>
<h1>Notes for <% response.write(tagname) %></h1>
<p>For use is now:</p>
<%
response.write("Object: " & tagname)
response.write("<br />")
response.write("User: " & loginuser)
%>
</header>
<section>
<form action="writenote.asp" method="post">
<fieldset>
<legend>New note for <% response.write(tagname) %></legend>
<label for="tid">Time:</label>
<input type="datetime-local" id="tid" name="timestamp" value="<% Response.Write Now %>" readonly><br />
<label for="objekt">Object:</label>
<input type="text" id="objekt" name="object" value="<% response.write(tagname) %>" readonly><br />
<label for="bruger">User:</label>
<input type="text" id="bruger" name="user" value="<% response.write(loginuser) %>" readonly><br />
<p></p>Note (max. 300 chars):</p>
<textarea name="note" rows="11" cols="30" maxlength="300" required></textarea>
<br /><br />
<input type="submit" value="Submit">
<input type="reset">
</fieldset>
</form>
</section>
<section>
<fieldset>
<legend>Notes for <% response.write(tagname) %></legend>
<input type="button" value="Print Notes" onclick="JavaScript:printTextArea('notetxtarea');">
<textarea name="note" rows="23" cols="40" id="notetxtarea" readonly>
<%
dim strSQL,printStr
'Open the recordset object executing the SQL statement and return records
strSQL = "SELECT * FROM dbo.notes WHERE tag = '" & tagname & "' ORDER BY time DESC"
set objRecordSet = objConn.Execute (strSQL)
'first of all determine whether there are any records
If objRecordSet.EOF Then
Response.Write("No records of " & tagname)
Else
Do While NOT objRecordSet.EOF
Response.write(objRecordSet("time") & vbCrLf)
Response.write(objRecordSet("tag") & vbCrLf)
Response.write(objRecordSet("username")& vbCrLf)
Response.write(objRecordSet("note")& vbCrLf)
Response.write(vbCrLf)
Response.write("-----------------------")
Response.write(vbCrLf)
objRecordSet.MoveNext
Loop
End If
objRecordSet.Close
Set objRecordSet=nothing
objConn.Close
Set objConn=nothing
%>
</textarea>
</fieldset>
</section>
<div class="clearer"></div>
<footer>
<p>Things in my footer</p>
</footer>
</body>
</html>
From "writenote.asp":
<%@ Language="VBScript" %>
<!-- #include file="connect.asp" -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Execute write to file</title>
</head>
<body>
<%
dim username,tag,time,note,query,objs
username = Request.Form("user")
tag = Request.Form("object")
time = Request.Form("timestamp")
note = Request.Form("note")
objConn.Execute = "INSERT INTO dbo.notes (tag,username,time,note) VALUES ('"+ tag +"','"+ username +"','"+ time +"','"+ note +"')"
Response.Redirect("notes.asp")
objRecordSet.Close
Set objRecordSet=nothing
objConn.Close
Set objConn=nothing
%>
</body>
</html>
tag
andobject
are mixed up, not declared, and need a attention. Question: Do you know what year it is? :) Or, do you just enjoy working with old technology? – R. Richards