Hi guys, i can't figure this one out... I have a form that displays jobs in progress. on this form you can enter materials for whichever job you select from the list. I'm trying to check the database to see if a job number already exists, if it does i want to go to the page that displays what's been ordered for that job, if the job number doesn't exist, i want to go to the page that lets you enter materials. So from my job listings page, when you click on materials, i'm running a little script to check the database for the job number then redirecting to the correct page based on the results. What's happening is even if the job number does exist, it's still taking me to the page to order materials, when it should be taking me to the page that lists what's already been ordered. anyway any help on this is greatly appreciated. here's my code to check the database (this is right after you click on materials from the main job listing page)
<%@ LANGUAGE="VBSCRIPT" %>
<%
Option Explicit
Response.Buffer = True
Response.ContentType = "text/html; charset=iso-8859-1"
Session("JobCode"
= Request.QueryString("JobCode"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
'--------------------------------------------------------------
'--- Module: .asp
'---
'--- Version: 1.0
'---
'--- Purpose:
'---
'--- Dependencies:
'---
'--- Notes:
'---
'--- Author: Gene Magerr genemagerr@hotmail.com
'--- Copyright 2001 Magerr Media all rights reserved
'--------------------------------------------------------------
%>
<!--#include file="../adovbs.inc"-->
<%
'--------------------------------------------------------------
Dim rsCheck, cnCheck, JobCode, strSQL
'--------------------------------------------------------------
'--- Declarations
'--------------------------------------------------------------
Set cnCheck = Server.CreateObject("ADODB.Connection"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
cnCheck.Open "DSN=PSS"
strSQL = "SELECT * FROM Orders"
Set rsCheck = Server.CreateObject("ADODB.Recordset"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
rsCheck.Open strSQL, cnCheck, adOpenDynamic, adLockPessimistic
'--------------------------------------------------------------
'--- Initialization
'--------------------------------------------------------------
Do While Not rsCheck.EOF
If Session("JobCode"
= rsCheck.Fields.Item("JobCode"
.Value Then
Response.Redirect "DisplayQty.asp?JobCode="& Session("JobCode"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Else
Response.Redirect "MatOrderMaster.asp?JobCode="& Session("JobCode"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
End If
rsCheck.MoveNext
Loop
rsCheck.Close
Set rsCheck = Nothing
cnCheck.Close
Set cnCheck = Nothing
'--------------------------------------------------------------
'--- Body
'--------------------------------------------------------------
'--------------------------------------------------------------
'--- Begin HTML output
'--------------------------------------------------------------
%>
<%
'----------------------------------------------------------------------
'--- End HTML Output
'----------------------------------------------------------------------
'----------------------------------------------------------------------
' All ASP post processing code goes here, as well as
' sub routines and functions
'----------------------------------------------------------------------
%>
Thanks in advance.
<%@ LANGUAGE="VBSCRIPT" %>
<%
Option Explicit
Response.Buffer = True
Response.ContentType = "text/html; charset=iso-8859-1"
Session("JobCode"
'--------------------------------------------------------------
'--- Module: .asp
'---
'--- Version: 1.0
'---
'--- Purpose:
'---
'--- Dependencies:
'---
'--- Notes:
'---
'--- Author: Gene Magerr genemagerr@hotmail.com
'--- Copyright 2001 Magerr Media all rights reserved
'--------------------------------------------------------------
%>
<!--#include file="../adovbs.inc"-->
<%
'--------------------------------------------------------------
Dim rsCheck, cnCheck, JobCode, strSQL
'--------------------------------------------------------------
'--- Declarations
'--------------------------------------------------------------
Set cnCheck = Server.CreateObject("ADODB.Connection"
cnCheck.Open "DSN=PSS"
strSQL = "SELECT * FROM Orders"
Set rsCheck = Server.CreateObject("ADODB.Recordset"
rsCheck.Open strSQL, cnCheck, adOpenDynamic, adLockPessimistic
'--------------------------------------------------------------
'--- Initialization
'--------------------------------------------------------------
Do While Not rsCheck.EOF
If Session("JobCode"
Response.Redirect "DisplayQty.asp?JobCode="& Session("JobCode"
Else
Response.Redirect "MatOrderMaster.asp?JobCode="& Session("JobCode"
End If
rsCheck.MoveNext
Loop
rsCheck.Close
Set rsCheck = Nothing
cnCheck.Close
Set cnCheck = Nothing
'--------------------------------------------------------------
'--- Body
'--------------------------------------------------------------
'--------------------------------------------------------------
'--- Begin HTML output
'--------------------------------------------------------------
%>
<%
'----------------------------------------------------------------------
'--- End HTML Output
'----------------------------------------------------------------------
'----------------------------------------------------------------------
' All ASP post processing code goes here, as well as
' sub routines and functions
'----------------------------------------------------------------------
%>
Thanks in advance.