Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing Database Fields to memo boxes

Posted on 1999-01-28
2
Medium Priority
?
170 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 400 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

722 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