Using response.write with a access database

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
phate
Newbie
Posts: 2
Joined: Fri Oct 08, 2004 8:49 am

Using response.write with a access database

Post by phate » Fri Oct 08, 2004 8:57 am

Wonder if anyone can help.

I am designing a web page using vbscript and MS Access database.

The administration pages capture the information on products i.e. screen size, height etc. and saves them to the database to be displayed on the customer web pages.

When my users fill in the details for screen size they use characters usually reserved for coding i.e. 15" for 15 inch.

When I use response.write objrs("recordfield") to display the record information the page gets messed up because of the " in the record field.

Is there a way to display the record information as a block of text and not have to worry about what the content is.

Lumumba

Post by Lumumba » Fri Oct 08, 2004 11:38 am

I've no idea if you can declare the " char as a literal, so it won't interfere with the syntax of VBS.

Maybe it's worth to check one of this ...
response.write objrs("15'"")
response.write objrs("15\"")
response.write objrs("15`"")

phate
Newbie
Posts: 2
Joined: Fri Oct 08, 2004 8:49 am

Post by phate » Fri Oct 08, 2004 4:47 pm

Here's the relevant bits of code, hope it clarify it a bit

prodsql = "SELECT * FROM products WHERE ID = " & id
set prodrs = Server.CreateObject("ADODB.RecordSet")
prodrs.open prodsql, objconn, , adopenkeyset






">" align="top">

">














The code basically goes though each of the fields in the record and displays them on the screen in a table. The problem is that some of the fields have HTML characters in them and when the page is put together it gets messed up by there being HTML code characters like “ and &

I need a way of safely displaying the record field data, regardless of what it is without it being interpreted as HTML code.

Any ideas :(

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts