473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

VBSCript inside ASP page

I am sorry if this sounds hokey but I am a newbie to ASP.

I have a VBScript running in an ASP page. The script makes a
connection to Oracle via and ADODB connection. When my clients connect
to the ASP page they get Oracle client issues. How do I make the
script run from the server side to eliminatew any oracle client issues
or oracle tns names issues.

Hope someone can help

Paul

Code

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Untitled Document</title>
</head>

<body>
<div align="center"><img src="pics/banner_new.jpg" width="700"
height="80" /> <br />


<script type="text/vbscript">

Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objConnection2 =
CreateObject("ADODB.Connection")
Set objRecordset2 = CreateObject("ADODB.Recordset")

objConnection2.Open = "DRIVER={Microsoft ODBC for
Oracle}; SERVER=<removed>; UID=<removed>; PWD=<removed>"

strQuery1 = "SELECT TRUNC(log_date_time)
DAY,UPPER(SUBSTR(workstation,1,3)) WORKSTATION, COUNT(*) COUNT FROM
member_log WHERE logon_type='LOGON' GROUP BY
TRUNC(log_date_time),UPPER(SUBSTR(workstation,1,3) )"
' strQuery1 = "Select * from member_log"

objRecordset2.Open strQuery1, _
objConnection2, adOpenStatic, adLockOptimistic
' If Not objRecordSet.EOF Then
'objRecordSet.MoveFirst

Do Until objRecordSet2.EOF

If Left(ObjRecordSet2("WORKSTATION"),3) = "W03"
Then
'document.write "WESTAMPTON" & vbTab &
(ObjRecordSet2("WORKSTATION")) & vbTab & (ObjRecordSet2("DAY")) & vbTab
& (ObjRecordSet2("COUNT"))
wh1= (ObjRecordSet2("Day")) & "&nbsp" & "&nbsp"
& "&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp"&"&nbsp"&"&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"& (ObjRecordSet2("COUNT")) & "<br>"
wh = wh + wh1
testw = CInt(ObjRecordSet2("COUNT"))
westh = westH + testw
Elseif Left(ObjRecordSet2("WORKSTATION"),3) = "W05" Then
testv = CInt(ObjRecordSet2("COUNT"))
vnld = vnld + testv
vn1= (ObjRecordSet2("Day")) & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp"&"&nbsp"&"&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"& (ObjRecordSet2("COUNT")) & "<br>"
vn = vn + vn1

Elseif Left(ObjRecordSet2("WORKSTATION"),3) =
"W10" Then
testnb = CInt(ObjRecordSet2("COUNT"))
newb = newb + testnb
nb1= (ObjRecordSet2("Day")) & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp"&"&nbsp"&"&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"& (ObjRecordSet2("COUNT")) & "<br>"
nb = nb + nb1
Elseif Left(ObjRecordSet2("WORKSTATION"),3) = "W05"
Then
testv = CInt(ObjRecordSet2("COUNT"))
vnld = vnld + testv
vn1= (ObjRecordSet2("Day")) & vbTab & (ObjRecordSet2("COUNT")) &
"<br>"
vn = vn + vn1
Elseif Left(ObjRecordSet2("WORKSTATION"),3) = "W12"
Then
testd = CInt(ObjRecordSet2("COUNT"))
dov = dov + testd
dv1= (ObjRecordSet2("Day")) & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp"&"&nbsp"&"&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"& (ObjRecordSet2("COUNT")) & "<br>"
dv = dv + dv1

End If
objRecordset2.movenext
Loop
objRecordset2.Close
objConnection2.Close

document.write ""
document.write "WESTHAMPTON" & "<br>"
document.write "DATE"& "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" & "COUNT"
& "<br>"
document.write wh
document.write "Total For WestHampton: " & westh & "<br>" & "<br>"
document.write ""
document.write "VINELAND" & "<br>"
document.write "DATE" & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" & "COUNT"
& "<br>"
document.write vn
document.write "Total for Vineland: " & vnld & "<br>" & "<br>"
document.write ""
document.write" NEW BRUNSWICK" & "<br>"
document.write "DATE" & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" & "COUNT"
& "<br>"
document.write nb
document.write "Total for New Brunswick: " & newb & "<br>" & "<br>"

document.write ""
document.write"DOVER" & "<br>"
document.write "DATE"& "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" & "COUNT"
& "<br>"
document.write dv
document.write "Total for Dover: " & dov

</script>

</div>
<p align="center">&nbsp;</p>
</body>
</html>

Nov 3 '05 #1
3 6017
Basically speaking, run that script server-side, and instead of
document.write, you use Response.Write.

Get rid of the "<script type="text/vbscript"> stuff. Use:

<%
'''code
%>

Or, you can use
<script type="text/vbscript" runat="server"></script>,
but it's more common to use <% and %> as it's shorthand for that (assuming
VBScript is the declared language for the page, or the default language in
your app, which it is by default).

Ray at work

"pjglick" <pa**************@dol.state.nj.us> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I am sorry if this sounds hokey but I am a newbie to ASP.

I have a VBScript running in an ASP page. The script makes a
connection to Oracle via and ADODB connection. When my clients connect
to the ASP page they get Oracle client issues. How do I make the
script run from the server side to eliminatew any oracle client issues
or oracle tns names issues.

Hope someone can help

Paul

Code

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Untitled Document</title>
</head>

<body>
<div align="center"><img src="pics/banner_new.jpg" width="700"
height="80" /> <br />


<script type="text/vbscript">

Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objConnection2 =
CreateObject("ADODB.Connection")
Set objRecordset2 = CreateObject("ADODB.Recordset")

objConnection2.Open = "DRIVER={Microsoft ODBC for
Oracle}; SERVER=<removed>; UID=<removed>; PWD=<removed>"

strQuery1 = "SELECT TRUNC(log_date_time)
DAY,UPPER(SUBSTR(workstation,1,3)) WORKSTATION, COUNT(*) COUNT FROM
member_log WHERE logon_type='LOGON' GROUP BY
TRUNC(log_date_time),UPPER(SUBSTR(workstation,1,3) )"
' strQuery1 = "Select * from member_log"

objRecordset2.Open strQuery1, _
objConnection2, adOpenStatic, adLockOptimistic
' If Not objRecordSet.EOF Then
'objRecordSet.MoveFirst

Do Until objRecordSet2.EOF

If Left(ObjRecordSet2("WORKSTATION"),3) = "W03"
Then
'document.write "WESTAMPTON" & vbTab &
(ObjRecordSet2("WORKSTATION")) & vbTab & (ObjRecordSet2("DAY")) & vbTab
& (ObjRecordSet2("COUNT"))
wh1= (ObjRecordSet2("Day")) & "&nbsp" & "&nbsp"
& "&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp"&"&nbsp"&"&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"& (ObjRecordSet2("COUNT")) & "<br>"
wh = wh + wh1
testw = CInt(ObjRecordSet2("COUNT"))
westh = westH + testw
Elseif Left(ObjRecordSet2("WORKSTATION"),3) = "W05" Then
testv = CInt(ObjRecordSet2("COUNT"))
vnld = vnld + testv
vn1= (ObjRecordSet2("Day")) & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp"&"&nbsp"&"&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"& (ObjRecordSet2("COUNT")) & "<br>"
vn = vn + vn1

Elseif Left(ObjRecordSet2("WORKSTATION"),3) =
"W10" Then
testnb = CInt(ObjRecordSet2("COUNT"))
newb = newb + testnb
nb1= (ObjRecordSet2("Day")) & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp"&"&nbsp"&"&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"& (ObjRecordSet2("COUNT")) & "<br>"
nb = nb + nb1
Elseif Left(ObjRecordSet2("WORKSTATION"),3) = "W05"
Then
testv = CInt(ObjRecordSet2("COUNT"))
vnld = vnld + testv
vn1= (ObjRecordSet2("Day")) & vbTab & (ObjRecordSet2("COUNT")) &
"<br>"
vn = vn + vn1
Elseif Left(ObjRecordSet2("WORKSTATION"),3) = "W12"
Then
testd = CInt(ObjRecordSet2("COUNT"))
dov = dov + testd
dv1= (ObjRecordSet2("Day")) & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp"&"&nbsp"&"&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"& (ObjRecordSet2("COUNT")) & "<br>"
dv = dv + dv1

End If
objRecordset2.movenext
Loop
objRecordset2.Close
objConnection2.Close

document.write ""
document.write "WESTHAMPTON" & "<br>"
document.write "DATE"& "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" & "COUNT"
& "<br>"
document.write wh
document.write "Total For WestHampton: " & westh & "<br>" & "<br>"
document.write ""
document.write "VINELAND" & "<br>"
document.write "DATE" & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" & "COUNT"
& "<br>"
document.write vn
document.write "Total for Vineland: " & vnld & "<br>" & "<br>"
document.write ""
document.write" NEW BRUNSWICK" & "<br>"
document.write "DATE" & "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" & "COUNT"
& "<br>"
document.write nb
document.write "Total for New Brunswick: " & newb & "<br>" & "<br>"

document.write ""
document.write"DOVER" & "<br>"
document.write "DATE"& "&nbsp" & "&nbsp" & "&nbsp"
&"&nbsp"&"&nbsp"&"&nbsp"&"&nbsp" &"&nbsp" &"&nbsp" &"&nbsp" & "COUNT"
& "<br>"
document.write dv
document.write "Total for Dover: " & dov

</script>

</div>
<p align="center">&nbsp;</p>
</body>
</html>

Nov 3 '05 #2
Thank you very much for replying

When I add the <script type="text/vbscript" runat="server"></script>

I get the following message.

The tag: "script" doesn't have an attribute: "runat" in currently
active versions. I am using IE6.

Any suggestions

Paul

Nov 3 '05 #3
"pjglick" wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
: Thank you very much for replying

It was nothing. (O:=

: When I add the <script type="text/vbscript" runat="server"></script>
:
: I get the following message.
:
: The tag: "script" doesn't have an attribute: "runat" in currently
: active versions. I am using IE6.
:
: Any suggestions

Yes, use ASP tags instead of script tags as Ray suggested.

<%@ Language="VBScript" %>
<%
Option Explicit
Response.Buffer = True

' inline code
' global variables

' code goes here

sub someSub(someParameter)
' local variables
' code goes here
end sub

function someFunction(someParameter, someOtherParameter)
' local variables
' code goes here
someFunction = someValueOfSomeCalculationOfSomeLocalVariable
end function
%>

http://w3schools.com/asp/

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Nov 4 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jerry wang | last post by:
I manipulate MSAgent AcitiveX object using VBScript at client side, I met a wierd problem when I debugged my ASPX page. when msagent recognize a phrase and fire event, my vbscript capture the event...
5
by: NanQuan | last post by:
I'm hoping someone can help me solve this error since I am at a total loss here. Usually I don't bother posting on any forums or groups on the internet and prefer to solve stuff myself but this is...
4
by: Anshul Gupta | last post by:
Hi, Is there a way i can just print a designated area out of the whole asp(or html) page using javascript or vbscript. i want to mark out the beginning and the end on the page and create a link...
7
by: skeddy | last post by:
In a nutshell, I'm trying to dynamically create a select box with ResultSet code in vbscript and then need to be able to access the value of that select box later with a Save button. I've got...
2
by: Beemer Biker | last post by:
I put together a few lines of vbscript so I could dump the contents of a string to my C drive. It worked fine in a small test.htm where I put the vbscript at the top of the file. It failed to...
1
by: Andrew Wan | last post by:
How can VBScript code access JScript code variables in the same ASP page? <SCRIPT LANGAUGE="VBScript"> Dim a a = 10 </SCRIPT> <SCRIPT LANGUAGE="JScript"> Response.Write(a); </SCRIPT>
2
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
5
Soniad
by: Soniad | last post by:
Hello, I want to include asp file within vbscript, this file name i am taking in variable . and when i use this variable in the include tag outside delimiters(<%%>), it does not work, <%Dim...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.