Solved

How do  I make an if statement to allow for different environments? global.asa file

Posted on 2014-02-24
17
268 Views
Last Modified: 2014-03-10
How do  I make an if statement to allow for different environments?
Like:

Data Source=VAWEBD.WORLD (DEV)
Data Source=VAWEBT.WORLD (TEST)
Data Source=VAWEBP.WORLD (PROD)

and keep it in this one file?

This one global.asa file will be in DEV, TEST, and PROD for the application.

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Application_OnStart
Application("SessionCount") = 0
'Microsoft OLEDB Provider for Oracle
Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBD.WORLD;User ID=main;Password=main;DistribTX=0;"
End Sub

Sub Session_OnStart
Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
Session.Timeout = 480
If Application("SessionCount") > 100 Then

Application.Lock
Application("SessionCount") = 0
Application.Unlock
Session.Timeout = 30   '120 minutes

' Here you would put any code you need to run
' do not surround the code with <% %> tags 
' For example you might run a database query that checks for expired accounts

End if
End sub

Sub Session_OnEnd
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub
Sub Session_OnStart
     Session.LCID = 1033
End Sub  
</SCRIPT>

Open in new window


Thanks, Michael
0
Comment
Question by:capturetheflag
  • 9
  • 8
17 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 39883661
I do something like this for my sites. Depending on your server names, it should work fine:

SUB Application_OnStart
    Application("SessionCount") = 0

    dim connString
    if InStr( LCase( Request.ServerVariables("SERVER_NAME") ), "www" ) > 0 then
        connString ="Provider=OraOLEDB.Oracle;Data Source=VAWEBP.WORLD;User ID=main;Password=main;xxx;"

    elseInStr( LCase( Request.ServerVariables("SERVER_NAME") ), "test" ) > 0 then
        connString ="Provider=OraOLEDB.Oracle;Data Source=VAWEBT.WORLD;User ID=main;Password=main;xxx;"

    elseInStr( LCase( Request.ServerVariables("SERVER_NAME") ), "dev" ) > 0 then
        connString ="Provider=OraOLEDB.Oracle;Data Source=VAWEBD.WORLD;User ID=main;Password=main;xxx;"

    else
        '-- error occurred, process accordingly
    end if
    
   Application("ConnectionString") = connString
end sub

Open in new window


I blanked out the password field with "xxx", you should never post sensitive data like that here.

if you have the work "test" in your url for your test server, it'll work. same for the dev server. if they have different differentiations then you'll need to adjust accordingly.
0
 
LVL 1

Author Comment

by:capturetheflag
ID: 39885837
Hello Big Monty,

My conditional if statement does not work.  Here is the code from the global asa file.
Here is all the code from the file.  Thanks, Michael
SUB Application_OnStart
Application("SessionCount") = 0
'Microsoft OLEDB Provider for Oracle
'Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data 'Source=VAWEBD.WORLD;User ID=main;Password=main;DistribTX=0;"

End Sub

Sub Session_OnStart

' Below is logic to determine which environment the application is running in
BaseURL = lcase(Request.ServerVariables("SERVER_NAME"))

Application("testVariable")="before condition"

if (instr(BaseURL,"dev.fema.net") > 0 OR instr(BaseURL,"10.166.225.158") > 0) then

' DEVELOPMENT SERVER SETTINGS
Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBD.WORLD;User ID=main;Password=main;DistribTX=0;"
Application("testVariable")="test string DEV"

elseif (instr(BaseURL,"test.fema.net") > 0 OR instr(BaseURL,"10.166.225.201") > 0) then

' TEST SERVER SETTINGS
Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBT.WORLD;User ID=main;Password=main;DistribTX=0;"
Application("testVariable")="test string TEST"
else

' PRODUCTION SERVER SETTINGS
Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBP.WORLD;User ID=main;Password=main;DistribTX=0;"
Application("testVariable")="test string PROD"
end if


Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
Session.Timeout = 480
If Application("SessionCount") > 100 Then

Application.Lock
Application("SessionCount") = 0
Application.Unlock
Session.Timeout = 30   '120 minutes

' Here you would put any code you need to run
' do not surround the code with <% %> tags 
' For example you might run a database query that checks for expired accounts

End if
End sub

Sub Session_OnEnd
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub
Sub Session_OnStart
     Session.LCID = 1033
End Sub 

Open in new window

0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39885851
what do you get for a value if you do

Response.write BaseURL?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 1

Author Comment

by:capturetheflag
ID: 39885856
Hello Big Monty,

Here is my code from the default asp file for the same app.
I tried a testString variable and it is not picking that up either.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<head>
<title>NPSC Preshift Notes</title>
<link href="css/new_screen.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/new_print.css" rel="stylesheet" type="text/css" media="print" />
<script src="js/validate.js" language="JavaScript" TYPE="TEXT/JavaScript"></script>
<script src="js/popup.js" language="JavaScript" TYPE="TEXT/JavaScript"></script>
<link href="css/CalendarControl.css" rel="stylesheet" type="text/css">
<script src="js/CalendarControl.js" language="javascript"></script>
</head>
<% 
MyConn = Application("ConnectionString")
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program1='General' and active = 'ACTIVE'"
Set RSTodayNotes_General = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_General.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program2='RI' and active = 'ACTIVE'"
Set RSTodayNotes_RI = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_RI.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program3='Helpline' and active = 'ACTIVE'"
Set RSTodayNotes_Helpline = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_Helpline.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program4='ONA' and active = 'ACTIVE'"
Set RSTodayNotes_ONA = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_ONA.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program5='Casework' and active = 'ACTIVE'"
Set RSTodayNotes_Casework = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_Casework.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program6='PSA' and active = 'ACTIVE'"
Set RSTodayNotes_PSA = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_PSA.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program7='QC' and active = 'ACTIVE'"
Set RSTodayNotes_QC = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_QC.open strSQL, MyConn
'Delete the Connection Object
Set MyConn = Nothing%>
<body id="online">
<div id="container2">

  <!--HEADER **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
  <!--#include file ="includes/header.asp"-->
  <!--//// END HEADER ///////////////////-->
  <!--HEADER NAVIGATION **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
 <!--#include file ="includes/header_navigation.asp"-->
  <!--/// END HEADER NAVIGATION ///////////////////-->
  
  
  <!--////////////////// MAIN CONTENT ///////////////////-->
	<div id="wrapper">
		<div id="content">
    <%testString =  Application("testVariable")%>
    <h1><%response.write testString%></h1>
		<a name="top"><h1>Preshift Notes for <%response.write FormatDateTime(now(),2)%></h1></a>
		<%if RSTodayNotes_General.eof = false then%>
			<table width="100%">
				<tr><a name="general"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">General Information</h2></th></a></tr>
			<%Do Until RSTodayNotes_General.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_General("notesid")%>"><%response.write RSTodayNotes_General("title") & "</a>&nbsp;" & RSTodayNotes_General("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_General("details")%>"><%response.write RSTodayNotes_General("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_General("more")%></td></tr>
						<%if instr(RSTodayNotes_General("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_General("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_General("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_General.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_General.close
		'Delete Recordset
			set RSTodayNotes_General = nothing%>
		<%if RSTodayNotes_RI.eof = false then%>
			<table with="100%">
				<tr><a name="ri"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Registration Intake</h2></th></a></tr>
			<%Do Until RSTodayNotes_RI.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_RI("notesid")%>"><%response.write RSTodayNotes_RI("title") & "</a>&nbsp;" & RSTodayNotes_RI("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_RI("details")%>"><%response.write RSTodayNotes_RI("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_RI("more")%></td></tr>
						<%if instr(RSTodayNotes_RI("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_RI("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_RI("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_RI.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_RI.close
		'Delete Recordset
			set RSTodayNotes_RI = nothing%>
		<%if RSTodayNotes_Helpline.eof = false then%>
			<table width="100%">
				<tr><a name="helpline"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Helpline</h2></th></a></tr>
			<%Do Until RSTodayNotes_Helpline.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_Helpline("notesid")%>"><%response.write RSTodayNotes_Helpline("title") & "</a>&nbsp;" & RSTodayNotes_Helpline("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_Helpline("details")%>"><%response.write RSTodayNotes_Helpline("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_Helpline("more")%></td></tr>
						<%if instr(RSTodayNotes_Helpline("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_Helpline("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_Helpline("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_Helpline.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_Helpline.close
		'Delete Recordset
			set RSTodayNotes_Helpline = nothing%>
	<%if RSTodayNotes_ONA.eof = false then%>
			<table width="100%">
				<tr><a name="ona"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Other Needs & Assistance</h2></th></a></tr>
			<%Do Until RSTodayNotes_ONA.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_ONA("notesid")%>"><%response.write RSTodayNotes_ONA("title") & "</a>&nbsp;" & RSTodayNotes_ONA("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_ONA("details")%>"><%response.write RSTodayNotes_ONA("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_ONA("more")%></td></tr>
						<%if instr(RSTodayNotes_ONA("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_ONA("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_ONA("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_ONA.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_ONA.close
		'Delete Recordset
			set RSTodayNotes_ONA = nothing%>
	<%if RSTodayNotes_PSA.eof = false then%>
			<table width="100%">
				<tr><a name="psa"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Performance Standards & Analysis</h2></th></a></tr>
			<%Do Until RSTodayNotes_PSA.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_PSA("notesid")%>"><%response.write RSTodayNotes_PSA("title") & "</a>&nbsp;" & RSTodayNotes_PSA("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_PSA("details")%>"><%response.write RSTodayNotes_PSA("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_PSA("more")%></td></tr>
						<%if instr(RSTodayNotes_PSA("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_PSA("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_PSA("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_PSA.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_PSA.close
		'Delete Recordset
			set RSTodayNotes_PSA = nothing%>
	<%if RSTodayNotes_Casework.eof = false then%>
			<table width="100%">
				<tr><a name="casework"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Casework</h2></th></a></tr>
			<%Do Until RSTodayNotes_Casework.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_Casework("notesid")%>"><%response.write RSTodayNotes_Casework("title") & "</a>&nbsp;" & RSTodayNotes_Casework("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_Casework("details")%>"><%response.write RSTodayNotes_Casework("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_Casework("more")%></td></tr>
						<%if instr(RSTodayNotes_Casework("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_Casework("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_Casework("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_Casework.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_Casework.close
		'Delete Recordset
			set RSTodayNotes_Casework = nothing%>
	<%if RSTodayNotes_QC.eof = false then%>
			<table width="100%">
				<tr><a name="qc"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Quality Control</h2></th></a></tr>
			<%Do Until RSTodayNotes_QC.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_QC("notesid")%>"><%response.write RSTodayNotes_QC("title") & "</a>&nbsp;" & RSTodayNotes_QC("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_QC("details")%>"><%response.write RSTodayNotes_QC("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_QC("more")%></td></tr>
						<%if instr(RSTodayNotes_QC("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_QC("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_QC("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_QC.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_QC.close
		'Delete Recordset
			set RSTodayNotes_QC = nothing%>
		</div>
	</div>
<!--////////////////// END MAIN CONTENT ///////////////////-->

<!--////////////////// LEFT COLUMN ///////////////////-->
<!--#include file ="includes/side_navigation.asp" -->
<!--////////////////// END LEFT COLUMN ///////////////////-->

  <!-- FOOOTER **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
   <!--#include file ="includes/footer.asp" -->
  <!--////////////////// END FOOTER ///////////////////-->
</div>
</body>
</html>

Open in new window

0
 
LVL 1

Author Comment

by:capturetheflag
ID: 39886367
Hello Big Monty,

I have tried a Response.write BaseURL and it is the correct url:  vsr.dev.fema.net.
Here is the error message I get now. thanks for your help!

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/preshift/Default.asp, line 20

Here is the default.asp code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<head>
<title>NPSC Preshift Notes</title>
<link href="css/new_screen.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/new_print.css" rel="stylesheet" type="text/css" media="print" />
<script src="js/validate.js" language="JavaScript" TYPE="TEXT/JavaScript"></script>
<script src="js/popup.js" language="JavaScript" TYPE="TEXT/JavaScript"></script>
<link href="css/CalendarControl.css" rel="stylesheet" type="text/css">
<script src="js/CalendarControl.js" language="javascript"></script>
</head>
<% 
MyConn = Application("ConnectionString")
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program1='General' and active = 'ACTIVE'"
Set RSTodayNotes_General = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_General.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program2='RI' and active = 'ACTIVE'"
Set RSTodayNotes_RI = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_RI.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program3='Helpline' and active = 'ACTIVE'"
Set RSTodayNotes_Helpline = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_Helpline.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program4='ONA' and active = 'ACTIVE'"
Set RSTodayNotes_ONA = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_ONA.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program5='Casework' and active = 'ACTIVE'"
Set RSTodayNotes_Casework = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_Casework.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program6='PSA' and active = 'ACTIVE'"
Set RSTodayNotes_PSA = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_PSA.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program7='QC' and active = 'ACTIVE'"
Set RSTodayNotes_QC = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_QC.open strSQL, MyConn
'Delete the Connection Object
Set MyConn = Nothing%>
<body id="online">
<div id="container2">

  <!--HEADER **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
  <!--#include file ="includes/header.asp"-->
  <!--//// END HEADER ///////////////////-->
  <!--HEADER NAVIGATION **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
 <!--#include file ="includes/header_navigation.asp"-->
  <!--/// END HEADER NAVIGATION ///////////////////-->
  
  
  <!--////////////////// MAIN CONTENT ///////////////////-->
    <div id="wrapper">
      <div id="content">
    <%testString =  Application("testVariable")
     BaseURL = lcase(Request.ServerVariables("SERVER_NAME"))%>
    <h1><%response.write baseURL%></h1>
    <h1><%response.write testString%></h1>
		<a name="top"><h1>Preshift Notes for <%response.write FormatDateTime(now(),2)%></h1></a>
		<%if RSTodayNotes_General.eof = false then%>
			<table width="100%">
				<tr><a name="general"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">General Information</h2></th></a></tr>
			<%Do Until RSTodayNotes_General.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_General("notesid")%>"><%response.write RSTodayNotes_General("title") & "</a>&nbsp;" & RSTodayNotes_General("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_General("details")%>"><%response.write RSTodayNotes_General("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_General("more")%></td></tr>
						<%if instr(RSTodayNotes_General("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_General("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_General("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_General.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_General.close
		'Delete Recordset
			set RSTodayNotes_General = nothing%>
		<%if RSTodayNotes_RI.eof = false then%>
			<table with="100%">
				<tr><a name="ri"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Registration Intake</h2></th></a></tr>
			<%Do Until RSTodayNotes_RI.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_RI("notesid")%>"><%response.write RSTodayNotes_RI("title") & "</a>&nbsp;" & RSTodayNotes_RI("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_RI("details")%>"><%response.write RSTodayNotes_RI("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_RI("more")%></td></tr>
						<%if instr(RSTodayNotes_RI("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_RI("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_RI("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_RI.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_RI.close
		'Delete Recordset
			set RSTodayNotes_RI = nothing%>
		<%if RSTodayNotes_Helpline.eof = false then%>
			<table width="100%">
				<tr><a name="helpline"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Helpline</h2></th></a></tr>
			<%Do Until RSTodayNotes_Helpline.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_Helpline("notesid")%>"><%response.write RSTodayNotes_Helpline("title") & "</a>&nbsp;" & RSTodayNotes_Helpline("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_Helpline("details")%>"><%response.write RSTodayNotes_Helpline("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_Helpline("more")%></td></tr>
						<%if instr(RSTodayNotes_Helpline("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_Helpline("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_Helpline("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_Helpline.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_Helpline.close
		'Delete Recordset
			set RSTodayNotes_Helpline = nothing%>
	<%if RSTodayNotes_ONA.eof = false then%>
			<table width="100%">
				<tr><a name="ona"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Other Needs & Assistance</h2></th></a></tr>
			<%Do Until RSTodayNotes_ONA.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_ONA("notesid")%>"><%response.write RSTodayNotes_ONA("title") & "</a>&nbsp;" & RSTodayNotes_ONA("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_ONA("details")%>"><%response.write RSTodayNotes_ONA("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_ONA("more")%></td></tr>
						<%if instr(RSTodayNotes_ONA("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_ONA("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_ONA("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_ONA.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_ONA.close
		'Delete Recordset
			set RSTodayNotes_ONA = nothing%>
	<%if RSTodayNotes_PSA.eof = false then%>
			<table width="100%">
				<tr><a name="psa"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Performance Standards & Analysis</h2></th></a></tr>
			<%Do Until RSTodayNotes_PSA.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_PSA("notesid")%>"><%response.write RSTodayNotes_PSA("title") & "</a>&nbsp;" & RSTodayNotes_PSA("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_PSA("details")%>"><%response.write RSTodayNotes_PSA("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_PSA("more")%></td></tr>
						<%if instr(RSTodayNotes_PSA("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_PSA("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_PSA("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_PSA.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_PSA.close
		'Delete Recordset
			set RSTodayNotes_PSA = nothing%>
	<%if RSTodayNotes_Casework.eof = false then%>
			<table width="100%">
				<tr><a name="casework"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Casework</h2></th></a></tr>
			<%Do Until RSTodayNotes_Casework.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_Casework("notesid")%>"><%response.write RSTodayNotes_Casework("title") & "</a>&nbsp;" & RSTodayNotes_Casework("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_Casework("details")%>"><%response.write RSTodayNotes_Casework("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_Casework("more")%></td></tr>
						<%if instr(RSTodayNotes_Casework("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_Casework("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_Casework("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_Casework.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_Casework.close
		'Delete Recordset
			set RSTodayNotes_Casework = nothing%>
	<%if RSTodayNotes_QC.eof = false then%>
			<table width="100%">
				<tr><a name="qc"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Quality Control</h2></th></a></tr>
			<%Do Until RSTodayNotes_QC.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_QC("notesid")%>"><%response.write RSTodayNotes_QC("title") & "</a>&nbsp;" & RSTodayNotes_QC("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_QC("details")%>"><%response.write RSTodayNotes_QC("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_QC("more")%></td></tr>
						<%if instr(RSTodayNotes_QC("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_QC("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_QC("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_QC.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_QC.close
		'Delete Recordset
			set RSTodayNotes_QC = nothing%>
		</div>
	</div>
<!--////////////////// END MAIN CONTENT ///////////////////-->

<!--////////////////// LEFT COLUMN ///////////////////-->
<!--#include file ="includes/side_navigation.asp" -->
<!--////////////////// END LEFT COLUMN ///////////////////-->

  <!-- FOOOTER **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
   <!--#include file ="includes/footer.asp" -->
  <!--////////////////// END FOOTER ///////////////////-->
</div>
</body>
</html>

Open in new window


And here is the global.asa code.
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Application_OnStart
Application("SessionCount") = 0
'Microsoft OLEDB Provider for Oracle
'Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBD.WORLD;User ID=main;Password=main;DistribTX=0;"

End Sub

Sub Session_OnStart

'Below is logic to determine which environment the application is running in
  BaseURL = lcase(Request.ServerVariables("SERVER_NAME"))

  Application("testVariable")="before condition"

 if (instr(BaseURL,"dev.fema.net") > 0 OR instr(BaseURL,"10.166.225.158") > 0) then

'DEVELOPMENT SERVER SETTINGS
 Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBD.WORLD;User ID=main;Password=main;DistribTX=0;"
Application("testVariable")="test string DEV"

elseif (instr(BaseURL,"test.fema.net") > 0 OR instr(BaseURL,"10.166.225.201") > 0) then

'TEST SERVER SETTINGS
Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBT.WORLD;User ID=main;Password=main;DistribTX=0;"
Application("testVariable")="test string TEST"
else

'PRODUCTION SERVER SETTINGS
Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBP.WORLD;User ID=main;Password=main;DistribTX=0;"
Application("testVariable")="test string PROD"
end if


Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
Session.Timeout = 480
If Application("SessionCount") > 100 Then

Application.Lock
Application("SessionCount") = 0
Application.Unlock
Session.Timeout = 30   '120 minutes

' Here you would put any code you need to run
' do not surround the code with <% %> tags 
' For example you might run a database query that checks for expired accounts

End if
End sub

Sub Session_OnEnd
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub
Sub Session_OnStart
     Session.LCID = 1033
End Sub  
</SCRIPT>

Open in new window

0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 500 total points
ID: 39886385
change

MyConn = Application("ConnectionString")

to

set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open Application("ConnectionString")

your application variable is a string, and not a connection object. you need to create that object and open the connection with your application variable
0
 
LVL 1

Author Comment

by:capturetheflag
ID: 39886426
Hello Big Monty,

I have made the change in default.asp and this is the error I get now.

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/preshift/Default.asp, line 18

Here is the latest code from default.asp. Thanks for keeping with me on this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<head>
<title>NPSC Preshift Notes</title>
<link href="css/new_screen.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/new_print.css" rel="stylesheet" type="text/css" media="print" />
<script src="js/validate.js" language="JavaScript" TYPE="TEXT/JavaScript"></script>
<script src="js/popup.js" language="JavaScript" TYPE="TEXT/JavaScript"></script>
<link href="css/CalendarControl.css" rel="stylesheet" type="text/css">
<script src="js/CalendarControl.js" language="javascript"></script>
</head>
<% 
set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open Application("ConnectionString")
'MyConn = Application("ConnectionString")
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program1='General' and active = 'ACTIVE'"
Set RSTodayNotes_General = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_General.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program2='RI' and active = 'ACTIVE'"
Set RSTodayNotes_RI = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_RI.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program3='Helpline' and active = 'ACTIVE'"
Set RSTodayNotes_Helpline = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_Helpline.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program4='ONA' and active = 'ACTIVE'"
Set RSTodayNotes_ONA = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_ONA.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program5='Casework' and active = 'ACTIVE'"
Set RSTodayNotes_Casework = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_Casework.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program6='PSA' and active = 'ACTIVE'"
Set RSTodayNotes_PSA = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_PSA.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program7='QC' and active = 'ACTIVE'"
Set RSTodayNotes_QC = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_QC.open strSQL, MyConn
'Delete the Connection Object
Set MyConn = Nothing%>
<body id="online">
<div id="container2">

  <!--HEADER **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
  <!--#include file ="includes/header.asp"-->
  <!--//// END HEADER ///////////////////-->
  <!--HEADER NAVIGATION **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
 <!--#include file ="includes/header_navigation.asp"-->
  <!--/// END HEADER NAVIGATION ///////////////////-->
  
  
  <!--////////////////// MAIN CONTENT ///////////////////-->
    <div id="wrapper">
      <div id="content">
    <%testString =  Application("testVariable")
     BaseURL = lcase(Request.ServerVariables("SERVER_NAME"))%>
    <h1><%response.write baseURL%></h1>
    <h1><%response.write testString%></h1>
		<a name="top"><h1>Preshift Notes for <%response.write FormatDateTime(now(),2)%></h1></a>
		<%if RSTodayNotes_General.eof = false then%>
			<table width="100%">
				<tr><a name="general"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">General Information</h2></th></a></tr>
			<%Do Until RSTodayNotes_General.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_General("notesid")%>"><%response.write RSTodayNotes_General("title") & "</a>&nbsp;" & RSTodayNotes_General("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_General("details")%>"><%response.write RSTodayNotes_General("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_General("more")%></td></tr>
						<%if instr(RSTodayNotes_General("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_General("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_General("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_General.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_General.close
		'Delete Recordset
			set RSTodayNotes_General = nothing%>
		<%if RSTodayNotes_RI.eof = false then%>
			<table with="100%">
				<tr><a name="ri"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Registration Intake</h2></th></a></tr>
			<%Do Until RSTodayNotes_RI.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_RI("notesid")%>"><%response.write RSTodayNotes_RI("title") & "</a>&nbsp;" & RSTodayNotes_RI("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_RI("details")%>"><%response.write RSTodayNotes_RI("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_RI("more")%></td></tr>
						<%if instr(RSTodayNotes_RI("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_RI("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_RI("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_RI.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_RI.close
		'Delete Recordset
			set RSTodayNotes_RI = nothing%>
		<%if RSTodayNotes_Helpline.eof = false then%>
			<table width="100%">
				<tr><a name="helpline"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Helpline</h2></th></a></tr>
			<%Do Until RSTodayNotes_Helpline.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_Helpline("notesid")%>"><%response.write RSTodayNotes_Helpline("title") & "</a>&nbsp;" & RSTodayNotes_Helpline("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_Helpline("details")%>"><%response.write RSTodayNotes_Helpline("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_Helpline("more")%></td></tr>
						<%if instr(RSTodayNotes_Helpline("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_Helpline("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_Helpline("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_Helpline.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_Helpline.close
		'Delete Recordset
			set RSTodayNotes_Helpline = nothing%>
	<%if RSTodayNotes_ONA.eof = false then%>
			<table width="100%">
				<tr><a name="ona"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Other Needs & Assistance</h2></th></a></tr>
			<%Do Until RSTodayNotes_ONA.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_ONA("notesid")%>"><%response.write RSTodayNotes_ONA("title") & "</a>&nbsp;" & RSTodayNotes_ONA("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_ONA("details")%>"><%response.write RSTodayNotes_ONA("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_ONA("more")%></td></tr>
						<%if instr(RSTodayNotes_ONA("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_ONA("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_ONA("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_ONA.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_ONA.close
		'Delete Recordset
			set RSTodayNotes_ONA = nothing%>
	<%if RSTodayNotes_PSA.eof = false then%>
			<table width="100%">
				<tr><a name="psa"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Performance Standards & Analysis</h2></th></a></tr>
			<%Do Until RSTodayNotes_PSA.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_PSA("notesid")%>"><%response.write RSTodayNotes_PSA("title") & "</a>&nbsp;" & RSTodayNotes_PSA("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_PSA("details")%>"><%response.write RSTodayNotes_PSA("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_PSA("more")%></td></tr>
						<%if instr(RSTodayNotes_PSA("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_PSA("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_PSA("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_PSA.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_PSA.close
		'Delete Recordset
			set RSTodayNotes_PSA = nothing%>
	<%if RSTodayNotes_Casework.eof = false then%>
			<table width="100%">
				<tr><a name="casework"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Casework</h2></th></a></tr>
			<%Do Until RSTodayNotes_Casework.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_Casework("notesid")%>"><%response.write RSTodayNotes_Casework("title") & "</a>&nbsp;" & RSTodayNotes_Casework("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_Casework("details")%>"><%response.write RSTodayNotes_Casework("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_Casework("more")%></td></tr>
						<%if instr(RSTodayNotes_Casework("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_Casework("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_Casework("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_Casework.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_Casework.close
		'Delete Recordset
			set RSTodayNotes_Casework = nothing%>
	<%if RSTodayNotes_QC.eof = false then%>
			<table width="100%">
				<tr><a name="qc"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Quality Control</h2></th></a></tr>
			<%Do Until RSTodayNotes_QC.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_QC("notesid")%>"><%response.write RSTodayNotes_QC("title") & "</a>&nbsp;" & RSTodayNotes_QC("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_QC("details")%>"><%response.write RSTodayNotes_QC("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_QC("more")%></td></tr>
						<%if instr(RSTodayNotes_QC("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_QC("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_QC("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_QC.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_QC.close
		'Delete Recordset
			set RSTodayNotes_QC = nothing%>
		</div>
	</div>
<!--////////////////// END MAIN CONTENT ///////////////////-->

<!--////////////////// LEFT COLUMN ///////////////////-->
<!--#include file ="includes/side_navigation.asp" -->
<!--////////////////// END LEFT COLUMN ///////////////////-->

  <!-- FOOOTER **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
   <!--#include file ="includes/footer.asp" -->
  <!--////////////////// END FOOTER ///////////////////-->
</div>
</body>
</html>

Open in new window

0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39886441
my pleasure, I like challenges like this :)

output your connection string like this:

Response.Write Application("ConnectionString")
set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open Application("ConnectionString")

and make sure the correct one is coming through. The error message is indicating it cannot form a valid connection to the database.
0
 
LVL 1

Author Comment

by:capturetheflag
ID: 39886472
Hello Big Monty,

Here is the error message.  This after using your code in default.asp.  The response write statement did not show up.

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/preshift/Default.asp, line 19

Here is the code from default.asp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<head>
<title>NPSC Preshift Notes</title>
<link href="css/new_screen.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/new_print.css" rel="stylesheet" type="text/css" media="print" />
<script src="js/validate.js" language="JavaScript" TYPE="TEXT/JavaScript"></script>
<script src="js/popup.js" language="JavaScript" TYPE="TEXT/JavaScript"></script>
<link href="css/CalendarControl.css" rel="stylesheet" type="text/css">
<script src="js/CalendarControl.js" language="javascript"></script>
</head>
<% 
Response.Write Application("ConnectionString")
set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open Application("ConnectionString")
'MyConn = Application("ConnectionString")
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program1='General' and active = 'ACTIVE'"
Set RSTodayNotes_General = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_General.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program2='RI' and active = 'ACTIVE'"
Set RSTodayNotes_RI = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_RI.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program3='Helpline' and active = 'ACTIVE'"
Set RSTodayNotes_Helpline = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_Helpline.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program4='ONA' and active = 'ACTIVE'"
Set RSTodayNotes_ONA = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_ONA.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program5='Casework' and active = 'ACTIVE'"
Set RSTodayNotes_Casework = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_Casework.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program6='PSA' and active = 'ACTIVE'"
Set RSTodayNotes_PSA = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_PSA.open strSQL, MyConn
strSQL="select * from readnew where trunc(startdate) = (select trunc(sysdate) from dual) and program7='QC' and active = 'ACTIVE'"
Set RSTodayNotes_QC = Server.CreateObject("ADODB.Recordset")
RSTodayNotes_QC.open strSQL, MyConn
'Delete the Connection Object
Set MyConn = Nothing%>
<body id="online">
<div id="container2">

  <!--HEADER **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
  <!--#include file ="includes/header.asp"-->
  <!--//// END HEADER ///////////////////-->
  <!--HEADER NAVIGATION **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
 <!--#include file ="includes/header_navigation.asp"-->
  <!--/// END HEADER NAVIGATION ///////////////////-->
  
  
  <!--////////////////// MAIN CONTENT ///////////////////-->
    <div id="wrapper">
      <div id="content">
    <%testString =  Application("testVariable")
     BaseURL = lcase(Request.ServerVariables("SERVER_NAME"))%>
    <h1><%response.write baseURL%></h1>
    <h1><%response.write testString%></h1>
		<a name="top"><h1>Preshift Notes for <%response.write FormatDateTime(now(),2)%></h1></a>
		<%if RSTodayNotes_General.eof = false then%>
			<table width="100%">
				<tr><a name="general"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">General Information</h2></th></a></tr>
			<%Do Until RSTodayNotes_General.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_General("notesid")%>"><%response.write RSTodayNotes_General("title") & "</a>&nbsp;" & RSTodayNotes_General("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_General("details")%>"><%response.write RSTodayNotes_General("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_General("more")%></td></tr>
						<%if instr(RSTodayNotes_General("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_General("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_General("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_General.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_General.close
		'Delete Recordset
			set RSTodayNotes_General = nothing%>
		<%if RSTodayNotes_RI.eof = false then%>
			<table with="100%">
				<tr><a name="ri"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Registration Intake</h2></th></a></tr>
			<%Do Until RSTodayNotes_RI.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_RI("notesid")%>"><%response.write RSTodayNotes_RI("title") & "</a>&nbsp;" & RSTodayNotes_RI("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_RI("details")%>"><%response.write RSTodayNotes_RI("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_RI("more")%></td></tr>
						<%if instr(RSTodayNotes_RI("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_RI("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_RI("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_RI.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_RI.close
		'Delete Recordset
			set RSTodayNotes_RI = nothing%>
		<%if RSTodayNotes_Helpline.eof = false then%>
			<table width="100%">
				<tr><a name="helpline"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Helpline</h2></th></a></tr>
			<%Do Until RSTodayNotes_Helpline.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_Helpline("notesid")%>"><%response.write RSTodayNotes_Helpline("title") & "</a>&nbsp;" & RSTodayNotes_Helpline("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_Helpline("details")%>"><%response.write RSTodayNotes_Helpline("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_Helpline("more")%></td></tr>
						<%if instr(RSTodayNotes_Helpline("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_Helpline("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_Helpline("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_Helpline.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_Helpline.close
		'Delete Recordset
			set RSTodayNotes_Helpline = nothing%>
	<%if RSTodayNotes_ONA.eof = false then%>
			<table width="100%">
				<tr><a name="ona"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Other Needs & Assistance</h2></th></a></tr>
			<%Do Until RSTodayNotes_ONA.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_ONA("notesid")%>"><%response.write RSTodayNotes_ONA("title") & "</a>&nbsp;" & RSTodayNotes_ONA("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_ONA("details")%>"><%response.write RSTodayNotes_ONA("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_ONA("more")%></td></tr>
						<%if instr(RSTodayNotes_ONA("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_ONA("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_ONA("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_ONA.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_ONA.close
		'Delete Recordset
			set RSTodayNotes_ONA = nothing%>
	<%if RSTodayNotes_PSA.eof = false then%>
			<table width="100%">
				<tr><a name="psa"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Performance Standards & Analysis</h2></th></a></tr>
			<%Do Until RSTodayNotes_PSA.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_PSA("notesid")%>"><%response.write RSTodayNotes_PSA("title") & "</a>&nbsp;" & RSTodayNotes_PSA("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_PSA("details")%>"><%response.write RSTodayNotes_PSA("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_PSA("more")%></td></tr>
						<%if instr(RSTodayNotes_PSA("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_PSA("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_PSA("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_PSA.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_PSA.close
		'Delete Recordset
			set RSTodayNotes_PSA = nothing%>
	<%if RSTodayNotes_Casework.eof = false then%>
			<table width="100%">
				<tr><a name="casework"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Casework</h2></th></a></tr>
			<%Do Until RSTodayNotes_Casework.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_Casework("notesid")%>"><%response.write RSTodayNotes_Casework("title") & "</a>&nbsp;" & RSTodayNotes_Casework("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_Casework("details")%>"><%response.write RSTodayNotes_Casework("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_Casework("more")%></td></tr>
						<%if instr(RSTodayNotes_Casework("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_Casework("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_Casework("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_Casework.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_Casework.close
		'Delete Recordset
			set RSTodayNotes_Casework = nothing%>
	<%if RSTodayNotes_QC.eof = false then%>
			<table width="100%">
				<tr><a name="qc"><th style="background-image: url(images/footer_bg.gif);" background="/images/footer_bg.gif"><h2 style="color:#fff;">Quality Control</h2></th></a></tr>
			<%Do Until RSTodayNotes_QC.eof = True%>
				<tr>
				<TD>
					<table>
						<tr><td><a href="displaynote.asp?notesid=<%response.write RSTodayNotes_QC("notesid")%>"><%response.write RSTodayNotes_QC("title") & "</a>&nbsp;" & RSTodayNotes_QC("disaster")%></td></tr>
						<tr><td>Links:&nbsp;<a href="<%response.write RSTodayNotes_QC("details")%>"><%response.write RSTodayNotes_QC("details")%></a></td></tr>
						<tr><td>Details:&nbsp;<%response.write RSTodayNotes_QC("more")%></td></tr>
						<%if instr(RSTodayNotes_QC("body"),"IFRAME") then %>
						<tr><td colspan="2"<%response.write replace(RSTodayNotes_QC("body"),"WIDTH=800","WIDTH=565px")%></td></tr>
						<%else%>
						<tr><td colspan="2"><%response.write RSTodayNotes_QC("body")%></td></tr>
						<%end if%>
					</table>
				</TD>
			</tr>
			<%'Move to the next record (important!!)
			RSTodayNotes_QC.MoveNext
			Loop%>
			<tr id="navtotop"><td><a href="#top">Back to Top</a></td></tr>
			</table>
		<%end if
		'Close Recordset
			RSTodayNotes_QC.close
		'Delete Recordset
			set RSTodayNotes_QC = nothing%>
		</div>
	</div>
<!--////////////////// END MAIN CONTENT ///////////////////-->

<!--////////////////// LEFT COLUMN ///////////////////-->
<!--#include file ="includes/side_navigation.asp" -->
<!--////////////////// END LEFT COLUMN ///////////////////-->

  <!-- FOOOTER **** DO NOT TOUCH THIS CODE ***** ///////////////////-->
   <!--#include file ="includes/footer.asp" -->
  <!--////////////////// END FOOTER ///////////////////-->
</div>
</body>
</html>

Open in new window


Here is the code from global.asa file
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Application_OnStart
Application("SessionCount") = 0
'Microsoft OLEDB Provider for Oracle
'Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBD.WORLD;User ID=main;Password=main;DistribTX=0;"

End Sub

Sub Session_OnStart

'Below is logic to determine which environment the application is running in
   BaseURL = lcase(Request.ServerVariables("SERVER_NAME"))

  Application("testVariable")="before condition"

 if (instr(BaseURL,"dev.fema.net") > 0 OR instr(BaseURL,"10.166.225.158") > 0) then

'DEVELOPMENT SERVER SETTINGS
 Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBD.WORLD;User ID=main;Password=main;DistribTX=0;"
Application("testVariable")="test string DEV"

elseif (instr(BaseURL,"test.fema.net") > 0 OR instr(BaseURL,"10.166.225.201") > 0) then

'TEST SERVER SETTINGS
Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBT.WORLD;User ID=main;Password=main;DistribTX=0;"
Application("testVariable")="test string TEST"
else

'PRODUCTION SERVER SETTINGS
Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBP.WORLD;User ID=main;Password=main;DistribTX=0;"
Application("testVariable")="test string PROD"
end if


Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
Session.Timeout = 480
If Application("SessionCount") > 100 Then

Application.Lock
Application("SessionCount") = 0
Application.Unlock
Session.Timeout = 30   '120 minutes

' Here you would put any code you need to run
' do not surround the code with <% %> tags 
' For example you might run a database query that checks for expired accounts

End if
End sub

Sub Session_OnEnd
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub
Sub Session_OnStart
     Session.LCID = 1033
End Sub  
</SCRIPT>

Open in new window

0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39886596
put a response.end directly underneath it then
0
 
LVL 1

Author Comment

by:capturetheflag
ID: 39886753
Hello Big Monty,

The response.end did not work in the default.asp.
I have any idea. Let's leave the code in default.asp in its original state and concentrate on global.asa.  Is it possible to put a response. write and/or a response.end in the global.asa conditional if statement? Where would I put it?
Because if I uncomment line 5, and comment out line 11 thru 32 (in global.asa) the connection string works. Thanks.

This works in DEV global.asa
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Application_OnStart
Application("SessionCount") = 0
'Microsoft OLEDB Provider for Oracle
Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBD.WORLD;User ID=main;Password=main;DistribTX=0;"

End Sub

Sub Session_OnStart

''Below is logic to determine which environment the application is running in
'   BaseURL = lcase(Request.ServerVariables("SERVER_NAME"))
'
'  Application("testVariable")="before condition"
'
' if (instr(BaseURL,"dev.fema.net") > 0 OR instr(BaseURL,"10.166.225.158") > 0) then
'
''DEVELOPMENT SERVER SETTINGS
'Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBD.WORLD;User ID=main;Password=main;DistribTX=0;"
'Application("testVariable")="test string DEV"
'
'elseif (instr(BaseURL,"test.fema.net") > 0 OR instr(BaseURL,"10.166.225.201") > 0) then
'
''TEST SERVER SETTINGS
'Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBT.WORLD;User ID=main;Password=main;DistribTX=0;"
'Application("testVariable")="test string TEST"
'else
'
''PRODUCTION SERVER SETTINGS
'Application("ConnectionString") ="Provider=OraOLEDB.Oracle;Data Source=VAWEBP.WORLD;User ID=main;Password=main;DistribTX=0;"
'Application("testVariable")="test string PROD"
'end if


Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
Session.Timeout = 480
If Application("SessionCount") > 100 Then

Application.Lock
Application("SessionCount") = 0
Application.Unlock
Session.Timeout = 30   '120 minutes

' Here you would put any code you need to run
' do not surround the code with <% %> tags 
' For example you might run a database query that checks for expired accounts

End if
End sub

Sub Session_OnEnd
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub
Sub Session_OnStart
     Session.LCID = 1033
End Sub  
</SCRIPT>

Open in new window

0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39886780
one more test first. change

Response.Write Application("ConnectionString")
set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open Application("ConnectionString")

to

Response.Write "connString = " & Application("ConnectionString")
Response.End
set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open Application("ConnectionString")
0
 
LVL 1

Accepted Solution

by:
capturetheflag earned 0 total points
ID: 39886835
Hello Big Monty,

You cannot have two Sub Session_OnStarts in an asa file.

D'OH!
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39891828
ok so did you take it out and did it work?
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39900674
has this issue been resolved by taking out one of the OnStart functions? if so, please close out the question
0
 
LVL 1

Author Closing Comment

by:capturetheflag
ID: 39917007
Thanks for the help Big Monty.  Your answers were helpful for future projects.
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39917472
my pleasure, glad I could help :)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question