Solved

Passing Database Fields to memo boxes

Posted on 1999-01-28
2
168 Views
Last Modified: 2013-12-25
I have an Access Database Table with a Comments field in it that I wish people to be able to amend via a web page.

When someone opens the update page, it will have a text box for people to enter new comments.  I know nothing about ASP except the Database Region Wizard that comes with Frontpage 98.  How can I pass the current information from the comments field in the database to the text box, to save either overwriting the data each time, or having the user enter the current data as well as the new data?

Please try and keep it simple, as my knowledge of ASP is very limited.

Thanks for any help that anyone can give me.
0
Comment
Question by:balabaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
PBall earned 100 total points
ID: 1859266
1. Retrieve the data using ASP before displaying it.

<%
  Set rs = Server.CreateObject("ADODB.Recordset")
  rs.Open "SELECT * FROM tablename WHERE fieldname = ....","dsn_name"
%>

2. Insert the following in between the <TEXTAREA></TEXTAREA>:

<TEXTAREA .....><%=rs("memo_field_name")%></TEXTAREA>

3. close the recordset somewhere near the end of the ASP file after you have retrieve all the data that you need from it.

<%
   rs.Close
   Set rs = Nothing
%>


Full sample:

<%
  'Get the date from previous form field called DateID.
  PickedDate = Request("DateID")

  if Len(PickedDate) < 1 Then
  'Default to current server date if there is non passed.
    PickedDate = Date
  else
  'Otherwise, make it official (change to datetime type)
    PickedDate = cDate(PickedDate)
  end if

  Set rs = Server.CreateObject("ADODB.Recordset")
  rs.Open "SELECT * FROM Diary WHERE Timestamp = '" & PickedDate & "'","dsnDiary"
%>
<html>
<head>
<title>Edit Diary</title>
</head>
<body>
<form name=frmEdit action='edit2.asp' method=post>
Timestamp: <%=PickedDate%><br>
Entry:
<textarea name=txtEntry wrap=virtual row=10 col=40><%
   'if recordset return something, show the record
   if Not (rs.BOF And rs.EOF) then
     Response.Write rs("Entry")
   end if
%></textarea><br>
<input type=submit name=btnNav value='Save Changes'>
<input type=submit name=btnNav value='Cancel Changes'>
</form>
</body>
</html>
<%
  rs.Close
  Set rs = Nothing
%>
0
 
LVL 6

Expert Comment

by:PBall
ID: 1859267
Some weird thing about text field (at least in SQL Server), they have to be displayed in order of appearance (at least from my experiences)

i.e.  you have 2 text fields, one called Blah and the other called Yuck.

if you retrieve it as SELECT Blah, Yuck FROM Ugh

you have to display Blah first and then Yuck and not the other way around, because it will caused an error.

I usually retrieve multiple text fields into variables and display the variables instead (in whichever order I want), as long as I retrieved it in the order of appearance, they seemed to work just fine :)

0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create an automated page index 9 110
Alert after MVC form submitted 1 40
WordPress 8 71
why is my slideshow so small on this wordpress site? 7 41
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question