View Full Version : using Wordpad files in Access databases

08-12-2002, 11:44 AM

I am working with an Access database with Wordpad documents as one of the fields. How can I extract the text from these documents to include it in a webpage? The code I am using at the moment generates an error (this is ASP and Javascript):

in HEAD -----------------------
var Recordset1 = Server.CreateObject("ADODB.Recordset");
Recordset1.Source = "SELECT * FROM table1";
var textob = Server.CreateObject("Scripting.FileSystemObject");
var text = textob.OpenTextFile(Recordset1.Fields.Item("doc_text").Value);

in BODY-----------------------
<table width="100%" height="45">

table1 has two fields, "title" and "doc_text", representing the document title and the document text respectively. The document text is held in a Wordpad file. At some point I want to use an HTML form to edit the files as well. Is this possible?



08-13-2002, 10:07 AM
About your last question :
yep. it's even very easy. just create a form with a textarea and insert the data from your recordset in it. Just like the example below (I use VB, sory)

<form name="FormName" action="update.asp" method="post">
<textarea name="textareaName" cols="40" rows="4"><%response.write("rs1.Fields("doc_text")%></textarea>

The text can be edited and is then send to update.asp where you can update the record in your database.

08-14-2002, 11:00 PM
Thanks raf.

What does the code in update.asp look like?


08-15-2002, 07:14 PM
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open 'Put your connection string here!

UpdateQuery = "UPDATE your_table_name SET doc_text = '" & doc_text & "' WHERE yourprimarykey = '" & whateverVariableYouSetUsingThePrimaryKeyInYourDatabase & "'"

'Response.Write(UpdateQuery) ' For debugging

Set Conn = Nothing

08-16-2002, 11:36 PM
Cool. I'm still having difficulties writing these files to the page though. I thought it would be a matter of using the same code I would to open an ordinary text file on the server and replacing the name of the text file with the field of the recordset, but that doesn't seem to work. Any ideas?


08-19-2002, 01:16 AM
I'd do some research on SQL statements - google or something should turn up plenty of them! :)

08-19-2002, 08:44 PM
I'll do that. If I find anything I'll post it here.


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum