asp and access db - edit textarea

M

mike

I have a form that I can edit the text from an access database if the
field is a text box but if it's a textarea it just appears blank.
Here's my code on my edit page:

<%

'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsHome 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query for the database
Dim lngRecordNo 'Holds the record number to be updated

'Read in the record number to be updated
lngRecordNo = CLng(Request.QueryString("ID"))

'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("homep.mdb")

'Set an active connection to the Connection object using DSN
connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsHome = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT homepc.* FROM homepc WHERE home_ID=" & lngRecordNo

'Open the recordset with the SQL query
rsHome.Open strSQL, adoCon
%>
<html>
<head>
<title></title>
</head>
<body bgcolor="white" text="black">
<!-- Begin form code -->
<form name="form" method="post" action="update_entry.asp">

Content:
<textarea name="content" WRAP rows="4" cols="50"><%=
rsHome("content") %></textarea>
<input type="hidden" name="home_ID" value="<% = rsHome("home_ID")
%>">
<input type="submit" name="Submit" value="Submit">
</form>
<!-- End form code -->
</body>
</html>
<%
'Reset server objects
rsHome.Close
Set rsHome = Nothing
Set adoCon = Nothing
%>


Can anyone shed some light on my problem or do you need more info?

Thanks for your time.
Mike
 
M

Maarten

See Value

<textarea name="content" WRAP rows="4" cols="50" value=" & Chr(34) &
rsHome("content") & Chr(34) & "></textarea>"
 
W

William Morris

WHOAAA there, Marten. Textareas have neither VALUE or WRAP attibutes.

If the "Content" is a memo field, move it to the end of your sql statement,
as in

"SELECT field1, field2, field...n, content FROM myTable"

I've found that with TEXT datatype in SQL Server, there's something in ODBC
that doesn't display the value unless it's the last field...maybe that'll
fix it for Access as well.

- Wm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top