W
Wayne...
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>
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>