Storing an ASP page

Nismo83

OSNN AZN Addict
Joined
13 Mar 2004
Messages
384
Help all professional programmer out here..

I need some help regarding on storing a ASP page in the database so that the user(receiver) can access it such as greeting cards with the message key in by the sender.

I hope u guys understand what i'm blabbing 'bout :D
 
Well you don't store the page. You just store the string with the message in it and assign it a unique ID number. Then the receiver opens a page with the ID number as a parameter and the page sidplas the appropriate string.
 
well.. thanks Zedric. I get the picture on how it works. But how do i store the message in a string? Any tutorial or some kind of example which explain in more detail? :D

Sorry to trouble you
 
I'm not so good at ASP but since it's similar to PHP I guess it would work like this:
Make a form with a textarea (for the message). Call it "message". Submit the form using POST to another page (or the same, your choise). The message will now be available in the ASP code (in PHP is directly in the variable "message"). Then you store it in the DB.
 
I dun get what u mean by The message will now be available in the ASP code (in PHP is directly in the variable "message").
 
OK. I the new page (the page you sibmitted the form data to) you will now have a variable called "message" that contains the message the user typed in on the previous case. This is how it is in PHP. It may be different in ASP but that can easily be found out if you look at examples (there are millions on the web).
 
This assumes you are using a access database which is very common for what you are requesting.
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "ConnectionStringHereLookForExamplesOnTheWeb"
set rs = conn.execute("Select * from tableNameHere where ColumnID = IDHERE")
%>

<!-- Apply your Html Formatting here -->

<%=rs("Message")%>

<%

conn.Close
Set rs = nothing
set conn = Nothing
%>

Now if you make a access database with 2 fields in it one called ColumnID wich will be your primary key and unique ID and one called Message that will probably be a field type "Memo" and use the little script I just wrote above you will be able to pull that info based on ID at will........
 
thanks a lot for the info..

I am currently {
61217616
| |
intrigue_alvin83@hotmail.com
| |
alvinauboonhock
}
=========================
Intel P4 1.5 Ghz
Intel D850GB MOBO
256MB PC 800 RDRAM
20GB Maxtor HDD (5400 RPM)
40GB Maxtor HDD (7200 RPM)
52X Creative CDROM
8X4X32 Creative CDRW
16X ASUS DVD ROM
Iomega 100 MB USB Zip Drive
SYBA Ultra ATA IDE controller card
SB live 5.1 DE
Aging Gainward 64MB GF2MX400 --> | Upgrading to GF4 Ti4 series |
Altec Lansing ACS 56
Dlink D538TX NIC

=========================
 
Code:
<%
	' connect to the MS Access database in the same directory
	strDbPath = Server.MapPath(".") & "\users.mdb"
	strconn="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("users.mdb")

	Set rs = Server.CreateObject("adodb.recordset")
	rs.Open "users", strconn, 2, 3

	If Request("Send") <> "" Then
            Set Mail = Server.CreateObject "XXX.mailserver")
		Mail.Host = strHost
		
		Mail.From = "XXX@abc.com"
		Mail.FromName = "Request("From")
		Mail.Subject = Request("Subject")
		Mail.Body = Request("Body")

		Mail.Send  ' finally send message

after storing the message, how do i incorporate it as a link to the mail that i wanted to send it out? For example is: http://www.abc.com?cards=1...

:confused:
 
Code:
<%
	' connect to the MS Access database in the same directory
	strDbPath = Server.MapPath(".") & "\users.mdb"
	strconn="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("users.mdb")

	Set rs = Server.CreateObject("adodb.recordset")
	rs.Open "users", strconn, 2, 3

	If Request("Send") <> "" Then
            Set Mail = Server.CreateObject "XXX.mailserver")
		Mail.Host = strHost
		
		Mail.From = "XXX@abc.com"
		Mail.FromName = "Request("From")
		Mail.Subject = Request("Subject")
		Mail.Body = Request("Body")

		Mail.Send  ' finally send message

after storing the message, how do i incorporate it as a link to the mail that i wanted to send it out? For example is: http://www.abc.com?cards=1...

BTW, i've done an normal mail appz and when i tried to send it, it says Error occurred: 550 5.7.1 Unable to relay for xxx@abc.com i'm using PostCast Server
:confused:
 
What you do is you store the entire mail in a variable (say mailBody). Something like this:
Code:
mailBody = "Hi!\nBla bla bla, yada yada. Click below to bla bla:\n\n [url]http://www.abc.com/?cards=[/url]" &
cardID & "\n\nBla bla, yada yada.\n\nRegards\nWhoever."
Sort of anyway. ;)
Then you send it off (provided you get the SMTP to work).
 
Code:
<%
dim strID 
strID=Request("cardid")
Set con=Server.CreateObject("ADODB.Connection")
Set RecordSet=Server.CreateObject("ADODB.RecordSet")

strconn="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("data.mdb")
con.Open strconn 

sql =  "SELECT * FROM birthday WHERE cardid = strid "

set RecordSet = con.execute(sql)


Response.write RecordSet("image")
%>

When this page load it kept load the first image only.. i want it to load based on the querystring that i have select from the previous page. How do i do it?

Eg. http://www.abc.com?id=1 -> display this image
http://www.abc.com?id=2 -> display that image
 
Does it know to replace strid but not cardid in the SQL string?

I'd do:
sql = "SELECT * FROM birthday WHERE cardid = " & strid
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back