473,414 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

how to store asp code in access and call back as text

I'm trying to make a sort of source code libary for some customers of
commonly used code to save them a bit of time [and cut down on my tech
support]
the problem I have is that although I can get the asp [and php etc...] code
into a field of an access database it will not be called back as text....
an example of what I am using is below...
all I am after is basically what lots of other major source code sites do
and that is diplay the code as text so the user can cut and paste it into
their projects.
this has got me beat.... I wasn't sure wether I needed to encode the source
somehow before putting into access or not [some of the html based stuff
trys to render itself on the page!]
Sorry for the untidy code BTW.
lots of thanks in advance if anyone can point me in the right direction
about this....

Wayne...

PS the field's code, code2 and code3 are the actual code fields
CODE:
============
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsCodevault 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("codevault.mdb")
Set rsCodevault = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM asp;"
rsCodevault.Open strSQL, adoCon
%>

<HTML>

<HEAD>
<TITLE>Codevault </TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
</HEAD>
<BODY BGCOLOR = "#FFFFFF">
<CENTER><H2>ASP Code</H2></CENTER>

<% if sCaption <> "" then
response.write "<B><FONT COLOR = RED>" & sCaption & "</B></FONT><P>"
end if
%>
<b>Title: </b>
<% Response.write (rsCodevault("title"))%>
<br>
<b>Posted by: </b>
<%
Response.write (rsCodevault("author")) 'displays ok
Response.write ("<br>")
Response.write ("<p>")
Response.write ("<b>Code 1</b>")
Response.write ("<br>")
TempString = rsCodevault("code") 'doesn't work
Response.write ("</p>")
Response.write ("<br>")
Response.write ("<p>")
Response.write ("<b>Code 2</b>")
Response.write ("<br>")
Response.write (rsCodevault("code2")) 'doesn't work
Response.write ("</p>")
Response.write ("<p>")
Response.write ("<b>Code 3</b>")
Response.write ("<br>")
Response.write (rsCodevault("code3")) 'doesn't work
Response.write ("</p>")
Response.write ("<b>About</b>")
Response.write ("<br>")
Response.write (rsCodevault("explaination")) 'works
Response.write ("<br>")
%>
<%
rsCodevault.Close
Set rsCodevault = Nothing
Set adoCon = Nothing
%>
</body>
</html>


Jul 19 '05 #1
3 1393
Try to enclose the code within a PRE tag.

You could also display the code and have a separate link to copy/paste or
download the code (it would allow to use HTML let's sya to have comments in
green or somethuing similar).

Patrice

"Wayne..." <wa***@secretwebdesign.com> a écrit dans le message de
news:40******@212.67.96.135...
I'm trying to make a sort of source code libary for some customers of
commonly used code to save them a bit of time [and cut down on my tech
support]
the problem I have is that although I can get the asp [and php etc...] code into a field of an access database it will not be called back as text....
an example of what I am using is below...
all I am after is basically what lots of other major source code sites do
and that is diplay the code as text so the user can cut and paste it into
their projects.
this has got me beat.... I wasn't sure wether I needed to encode the source somehow before putting into access or not [some of the html based stuff
trys to render itself on the page!]
Sorry for the untidy code BTW.
lots of thanks in advance if anyone can point me in the right direction
about this....

Wayne...

PS the field's code, code2 and code3 are the actual code fields
CODE:
============
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsCodevault 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("codevault.mdb")
Set rsCodevault = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM asp;"
rsCodevault.Open strSQL, adoCon
%>

<HTML>

<HEAD>
<TITLE>Codevault </TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
</HEAD>
<BODY BGCOLOR = "#FFFFFF">
<CENTER><H2>ASP Code</H2></CENTER>

<% if sCaption <> "" then
response.write "<B><FONT COLOR = RED>" & sCaption & "</B></FONT><P>"
end if
%>
<b>Title: </b>
<% Response.write (rsCodevault("title"))%>
<br>
<b>Posted by: </b>
<%
Response.write (rsCodevault("author")) 'displays ok
Response.write ("<br>")
Response.write ("<p>")
Response.write ("<b>Code 1</b>")
Response.write ("<br>")
TempString = rsCodevault("code") 'doesn't work
Response.write ("</p>")
Response.write ("<br>")
Response.write ("<p>")
Response.write ("<b>Code 2</b>")
Response.write ("<br>")
Response.write (rsCodevault("code2")) 'doesn't work
Response.write ("</p>")
Response.write ("<p>")
Response.write ("<b>Code 3</b>")
Response.write ("<br>")
Response.write (rsCodevault("code3")) 'doesn't work
Response.write ("</p>")
Response.write ("<b>About</b>")
Response.write ("<br>")
Response.write (rsCodevault("explaination")) 'works
Response.write ("<br>")
%>
<%
rsCodevault.Close
Set rsCodevault = Nothing
Set adoCon = Nothing
%>
</body>
</html>

Jul 19 '05 #2
sSource = Replace(rst("Source"), "<", "&lt;")
sSource = Replace(rst("Source"), ">", "&gt;")

or

sSource = Replace(Replace(rst("Source"), "<", "&lt;"), ">", "&gt;")

_Should_ work.........

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Wayne..." <wa***@secretwebdesign.com> wrote in message
news:40******@212.67.96.135...
I'm trying to make a sort of source code libary for some customers of
commonly used code to save them a bit of time [and cut down on my tech
support]
the problem I have is that although I can get the asp [and php etc...] code into a field of an access database it will not be called back as text....
an example of what I am using is below...
all I am after is basically what lots of other major source code sites do
and that is diplay the code as text so the user can cut and paste it into
their projects.
this has got me beat.... I wasn't sure wether I needed to encode the source somehow before putting into access or not [some of the html based stuff
trys to render itself on the page!]
Sorry for the untidy code BTW.
lots of thanks in advance if anyone can point me in the right direction
about this....

Wayne...

PS the field's code, code2 and code3 are the actual code fields
CODE:
============
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsCodevault 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("codevault.mdb")
Set rsCodevault = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM asp;"
rsCodevault.Open strSQL, adoCon
%>

<HTML>

<HEAD>
<TITLE>Codevault </TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
</HEAD>
<BODY BGCOLOR = "#FFFFFF">
<CENTER><H2>ASP Code</H2></CENTER>

<% if sCaption <> "" then
response.write "<B><FONT COLOR = RED>" & sCaption & "</B></FONT><P>"
end if
%>
<b>Title: </b>
<% Response.write (rsCodevault("title"))%>
<br>
<b>Posted by: </b>
<%
Response.write (rsCodevault("author")) 'displays ok
Response.write ("<br>")
Response.write ("<p>")
Response.write ("<b>Code 1</b>")
Response.write ("<br>")
TempString = rsCodevault("code") 'doesn't work
Response.write ("</p>")
Response.write ("<br>")
Response.write ("<p>")
Response.write ("<b>Code 2</b>")
Response.write ("<br>")
Response.write (rsCodevault("code2")) 'doesn't work
Response.write ("</p>")
Response.write ("<p>")
Response.write ("<b>Code 3</b>")
Response.write ("<br>")
Response.write (rsCodevault("code3")) 'doesn't work
Response.write ("</p>")
Response.write ("<b>About</b>")
Response.write ("<br>")
Response.write (rsCodevault("explaination")) 'works
Response.write ("<br>")
%>
<%
rsCodevault.Close
Set rsCodevault = Nothing
Set adoCon = Nothing
%>
</body>
</html>

Jul 19 '05 #3
On Wed, 2 Jun 2004 17:03:05 +0100, "Wayne..."
<wa***@secretwebdesign.com> wrote:

try "server.htmlencode()" ... I just lightly skimmed the article but
it seems you want to put the text to the browser... try that
function.

I'm trying to make a sort of source code libary for some customers of
commonly used code to save them a bit of time [and cut down on my tech
support]
the problem I have is that although I can get the asp [and php etc...] code
into a field of an access database it will not be called back as text....
an example of what I am using is below...
all I am after is basically what lots of other major source code sites do
and that is diplay the code as text so the user can cut and paste it into
their projects.
this has got me beat.... I wasn't sure wether I needed to encode the source
somehow before putting into access or not [some of the html based stuff
trys to render itself on the page!]
Sorry for the untidy code BTW.
lots of thanks in advance if anyone can point me in the right direction
about this....

Wayne...

PS the field's code, code2 and code3 are the actual code fields
CODE:
============
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsCodevault 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("codevault.mdb")
Set rsCodevault = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM asp;"
rsCodevault.Open strSQL, adoCon
%>

<HTML>

<HEAD>
<TITLE>Codevault </TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
</HEAD>
<BODY BGCOLOR = "#FFFFFF">
<CENTER><H2>ASP Code</H2></CENTER>

<% if sCaption <> "" then
response.write "<B><FONT COLOR = RED>" & sCaption & "</B></FONT><P>"
end if
%>
<b>Title: </b>
<% Response.write (rsCodevault("title"))%>
<br>
<b>Posted by: </b>
<%
Response.write (rsCodevault("author")) 'displays ok
Response.write ("<br>")
Response.write ("<p>")
Response.write ("<b>Code 1</b>")
Response.write ("<br>")
TempString = rsCodevault("code") 'doesn't work
Response.write ("</p>")
Response.write ("<br>")
Response.write ("<p>")
Response.write ("<b>Code 2</b>")
Response.write ("<br>")
Response.write (rsCodevault("code2")) 'doesn't work
Response.write ("</p>")
Response.write ("<p>")
Response.write ("<b>Code 3</b>")
Response.write ("<br>")
Response.write (rsCodevault("code3")) 'doesn't work
Response.write ("</p>")
Response.write ("<b>About</b>")
Response.write ("<br>")
Response.write (rsCodevault("explaination")) 'works
Response.write ("<br>")
%>
<%
rsCodevault.Close
Set rsCodevault = Nothing
Set adoCon = Nothing
%>
</body>
</html>


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Lues | last post by:
Hi, I'm trying to protect some data in tables with encription (you know why, don't you ;)) I must confess that I'm not very expirienced in writing code, especially encription code. Can any...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
9
by: 2D Rick | last post by:
With the help from members in the VB forum I've pieced together code that works in VB6 to create radial text similar to "text on a path" seen in graphics programs.(on a circle only) I use an...
5
by: Roy Gourgi | last post by:
Hi, I am used to working in Visual FoxPro and I would like to be able to create a database and store and retrieve information from it. What is the simplest way to do it and what should I be...
5
by: jqpdev | last post by:
Hello all... I'm coming from a Borland Delphi background. Delphi has a specific component called a Data Module. In the designer the Data Module behaves like a windows form. A developer can...
5
by: Guadala Harry | last post by:
What are my options for *securely* storing/retrieving the ID and password used by an ASP.NET application for accessing a SQL Server (using SQL Server authentication)? Please note that this ID and...
21
by: matvdl | last post by:
I have a system that was originally developed in asp - the pages are saved in SQL (there are over 10,000 pages) and saved to a temp directory in the server when requested by a client. I have...
0
by: Harley | last post by:
I am trying to write a personal app to keep a bank balance and history. The problem I'm haveing is finding a decent way to store the data on a pocketpc under .net compact framewok useing vb.net....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.