Groups | Blog | Home
all groups > inetserver asp db > may 2005 >

inetserver asp db : Newbie: transferring values to another page!


Chris Curtis
5/24/2005 12:00:00 AM
[quoted text, click to view]
Use the Querystring function

<%
'// Page1.asp
Dim strText
strText = "Some random text from somewhere"
Response.Redirect "page2.asp?ex=" & Server.URLEncode(strText)
%>

<%
'// Page2.asp
Response.Write "<b>Text from querystring:</b>" &
Request.Querystring("ex")
%>


Hi Steve

For the moment on the same page I have stripped out all the MySQL stuff and
added the following: (see below).
All I get is The page cannot be displayed which was the message I was
referring to earlier when I said it didn't work!
Strangely, even when I grey the 3 lines out it still doesn't display.
Only when I remove them does it display!

I've not got to the second page yet!

Chris

<%
@LANGUAGE = VBScript

Dim strText
strText = "Test Text"
Response.Redirect "mailenq.asp?ex=" & Server.URLEncode(strText)
%>

<html>
<head>........... etc

Bob Barrows [MVP]
5/24/2005 12:00:00 AM
[quoted text, click to view]

Remember what I said yesterday about fully describing your symptoms? This
could have been resolved already ...

You need to see the real error message:
http://www.aspfaq.com/show.asp?id=2109

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Bob Barrows [MVP]
5/24/2005 12:00:00 AM
[quoted text, click to view]


Oh! And the problem here is the @ directive needs to be in its own block:

<%@LANGUAGE = VBScript%>
<%
Dim strText
strText = "Test Text"
Response.Redirect "mailenq.asp?ex=" & Server.URLEncode(strText)
%>

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Chris Curtis
5/24/2005 12:00:00 AM
[quoted text, click to view]

That worked thank you.

Chris

Chris Curtis
5/24/2005 12:00:00 AM

[quoted text, click to view]
You live and learn!
Thank you!

Chris Curtis
5/24/2005 12:00:00 AM
Hi

I'm a bit out of my depth here but I have successfully managed to extract 2
pieces of information from a MySQL database; sMap & sLocation. These are
used on an asp page (below) which is located in a frame and the query is
dependent on an id provided from a cgi script!
From this page I would like to transfer these 2 values onto another asp page
which will contain a form.
I have tried running the selection query from the new 'form' page but it
can't refer to the all important 'id' querystring

I had thought I could write the values to a MySQL table and then retrieve
them on the new page

However, the INSERT INTO statement below will not work but it looks right (I
have resorted to trying to insert some text as an example). I'm guessing I'm
missing something simple! What?!

Apart from this there must be an alternative way?

Regards
Chris Curtis

<%

Dim sQuery, iMap, sMap, sLocation

iMap=Request.QueryString("id")

strConnection =
"driver={MySQL};server=127.0.0.1;database=mitre;UID=****;password=****
Set adoDataConn = Server.CreateObject("ADODB.Connection")
adoDataConn.Open strConnection

sQuery = "SELECT distinctrow industrialestates.estate FROM
industrialestates INNER JOIN maps on industrialestates.serial =
maps.indestateid WHERE maps.serial = " & iMap

Set RS = adoDataConn.Execute(sQuery)

sMap = RS("estate")

sQuery = "SELECT distinctrow location.name FROM location INNER JOIN maps
on location.serial = maps.locationid WHERE maps.serial = " & iMap

Set RS = adoDataConn.Execute(sQuery)

sLocation = RS("name")

sQuery = "INSERT INTO mailingenq(estate, town) VALUES('test', 'test2')"

Set RS = adoDataConn.Execute(sQuery)

RS.Close

adoDataConn.Close

Set RS = Nothing
Set adoDataConn = Nothing

%>

Steven Burn
5/24/2005 12:00:00 AM
Use the Querystring function

<%
'// Page1.asp
Dim strText
strText =3D "Some random text from somewhere"
Response.Redirect "page2.asp?ex=3D" & Server.URLEncode(strText)
%>

<%
'// Page2.asp
Response.Write "<b>Text from querystring:</b>" & =
Request.Querystring("ex")
%>

--=20
Regards

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

Keeping it FREE!

[quoted text, click to view]
"driver=3D{MySQL};server=3D127.0.0.1;database=3Dmitre;UID=3D****;password=
=3D****
[quoted text, click to view]
Chris Curtis
5/24/2005 12:00:00 AM
[quoted text, click to view]

Thank you both for those responses!
I'm not sure I fully understand all the content but will 'have a go'
I don't suppose anyoine knows where our programer went who dropped me in
this mess!

Chris

Bob Barrows [MVP]
5/24/2005 6:46:33 AM
[quoted text, click to view]

Not necessary. You can use Session variables, or querystring.

[quoted text, click to view]

What does "will not work" mean? error messages? Incorrect results? Nothing
happens? We cannot help you if you don't describe your symptoms!

[quoted text, click to view]

This may not causing your problem [1], but an INSERT query DOES NOT RETURN
RECORDS! It is extrememly wasteful to allow ADO to create a recordset when
you know your query is not returning records. A non-records-returning query
should be executed without a recordset, and you should tell ADO not to
bother creating a recordset object in the background (which it does by
default)

'if you've included the adovbs.inc file, or used a meta tag
'to reference the ADO type library, these two lines will
'not be needed:
const adCmdText=1
const adExecNoRecords

adoDataConn.Execute sQuery,,adCmdText + adExecNoRecords


You should stop using dynamic sql. Try out this technique:
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e


[1] however, in some cases, attempting to reuse a recordset object without
closing it first can cause errors.


Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Bob Barrows [MVP]
5/24/2005 6:58:59 AM
[quoted text, click to view]

Oops, I forgot to finish this statement. It should be:

const adExecNoRecords=128

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Mark Schupp
5/24/2005 7:48:58 AM
If the values are fairly short just include them and the id in the link used
to jump to the page with the form on it.



--
--Mark Schupp


[quoted text, click to view]

Kyle Peterson
5/24/2005 12:56:47 PM
forms and querystrings

http://www.powerasp.com/content/hintstips/asp-forms.asp

[quoted text, click to view]

Jon
5/29/2005 9:33:09 PM
If you are having problems using the code posted from Chris Curtis a
solution may be below ... especially if using Option Explicit. I had
problems and found a solutiong (Eventually).

Reference the ADO Library like so: (Not ASP code outside the <% %>)
<!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library"
TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"-->

And then declare the constants:
CONST adCmdText = &H0001
CONST adExecuteNoRecords = &H00000080

A complete list of the constant values can be found here:
http://asp.programmershelp.co.uk/adoconstants.php

--
Jon
warpedpixel@gmail.com
Look at that dead pixel on your screen! *SLAP* Gotcha!

Steven Burn
5/29/2005 11:23:42 PM
[quoted text, click to view]
</snip>

There's something very wrong if you need to include this......

<snip>
[quoted text, click to view]

Why would you need this for non-DB related events?

--=20
Regards

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

Keeping it FREE!

[quoted text, click to view]
AddThis Social Bookmark Button