Click to See Complete Forum and Search --> : asp page problem


airwolfdirectuk
03-16-2006, 10:48 AM
Hi,

trying to create a asp page for a system at work. Basically needs to pull the customers website details form the sql database and then display the website.

I have one that was prewritten to do delivery status but and unsure how to sort out the web page one.

Delivery asp page code is:

<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<!--#include File="adovbs.inc"-->
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
Response.Expires = 0
Dim sConsignRef
Dim Conn
Dim SQLStatement
Dim RecSet

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = "DSN=thardata;uid=sa;pwd=tharSQL"
Conn.Open
SQLstatement = "Select ConsignNote FROM DeliveryNote where [id]=" & Request.QueryString("jdeliveryid")
set RecSet = Conn.Execute(SQLstatement)
sConsignRef=RecSet.Fields(0)

Response.Redirect "http://www.city-link.co.uk/pod/podfrm.php?JobNo=" & sConsignRef
%>
</BODY>
</HTML>

so far on the web site code:

<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<!--#include File="adovbs.inc"-->
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
Response.Expires = 0
Dim sConsignRef
Dim Conn
Dim SQLStatement
Dim RecSet

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = "DSN=thardata;uid=sa;pwd=tharSQL"
Conn.Open
SQLstatement = "Select WebURL FROM Customers where [id]="
set RecSet = Conn.Execute(SQLstatement)
sConsignRef=RecSet.Fields(0)

Response.Redirect "" & sConsignRef
%>
</BODY>
</HTML>


I know the tables WebURL & Customers are correct.

just total confused on where to go. Any ideas?

Rob

chrismartz
03-16-2006, 05:01 PM
Could you clarify your request a little?

airwolfdirectuk
03-16-2006, 05:27 PM
basically need to know how this bit of code works

SQLstatement = "Select ConsignNote FROM DeliveryNote where [id]=" & Request.QueryString("jdeliveryid")

i understand the first bit, select consignnote from delivery, but dont understand what the rest is doing.

Any ideas?

Ubik
03-16-2006, 05:29 PM
Looks like it is getting a URL from the database and throwing the user (response.redirect) to the new URL.

chrismartz
03-16-2006, 05:39 PM
What that select statement is doing is this:
"Select ConsignNote FROM DeliveryNote where [id]=" & Request.QueryString("jdeliveryid")

Its selecting ConsignNote from the DeliveryNote table where the id of the requested information is equal to the querystring of jdeliveryid. The querystring is located in the web addresses url.

airwolfdirectuk
03-17-2006, 03:19 AM
many thnaks for that, so if i wanted to select WebURL from Customers and luach that url, what would i have to put?

Terrorke
03-17-2006, 04:24 AM
Select the URL from the database and then you can redirect your user to it via
response.redirect(url)

or you can do it via javascript :
window.location = 'url'

or open it in a new window via javascript :
window.open(url)