p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Variables from a Database


Message #1 by Craig Worcester <craig.worcester@p...> on Wed, 7 Feb 2001 16:13:05 -0000
Yes, but where are you putting the stuff into the HTML?

Response.write "<script language=javascript>"
Response.write "var NPage=""" & NPage & """;"
Response.write "var LPage=""" & LPage & """;"
Response.write "var IPage=""" & IPage & """;"
Response.write "</script>"
blah blah blah

>From: Craig Worcester <craig.worcester@p...>
>Reply-To: "Code Clinic" <proasp_codeclinic@p...>
>To: "Code Clinic" <proasp_codeclinic@p...>
>Subject: Variables from a Database
>Date: Wed, 7 Feb 2001 16:13:05 -0000
>
>Hi,
>
>I'm running a simple Access database that contains a field with page names
>(e.g.   nextpagename.htm)  The form contains two buttons that call the
>previous or next page, depending on the current page.  The pages file names
>are pulled out of the database into variables. For some reason I can't get
>the form buttons to use the variable value to call the next page, although
>if I print the variable contents it definitely contains the correct data.
>
>This code collect the correct values, but doesn't allow the form buttons to
>use the, to navigate:
>
><%
>  strCmd = "SELECT * FROM Toolkits WHERE KitCode LIKE '" & "sales"_
>   & "' AND PageNo LIKE '" & "1" & "'"
>  Set objRS = Server.CreateObject("ADODB.Recordset")
>
>objRS.Open strCmd, "DSN=pdcon", 0, 1, &H0001
>
>If objRS.EOF Then
>   Response.Redirect "../code/sorry.htm"
>Else
>  NPage= objRS("directory") & objRS("NextPage")
>  LPage = objRS("directory") & objRS("LastPage")
>  IPage = objRS("directory") & objRS("IndexPage")
>  KitCode = objRS("KitCode")
>  objRS.Close
>
>  Set objRS = Nothing
>End if
>%>
>
>I've had to use the code below to allow the form buttons to work, and this
>has to go into every page. Not a good way to manage the pages.
>
><script language=javascript>
>var NPage="./sales/applyrules.htm";
>var LPage="./sales/important.htm";
>var IPage="./sales/sales_index.htm";
></script>
>
>
>Help very welcome.
>
>Thanks
>Craig
>

  Return to Index