Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2012, 09:24 PM
Authorized User
 
Join Date: Jun 2006
Posts: 60
Thanks: 1
Thanked 0 Times in 0 Posts
Default Passing Parameters to Executable

Summary:
I'm trying to pass variables from an ASP query to an executable.

There are two files:
events.asp - this queries the database and displays the ParentEventID and the KPName.

Code:
<%
Option Explicit
Dim rsqdb, rsqdba, parenteventid
Dim strConnection, conn, neventID
set Conn=Server.CreateObject("ADODB.Connection")
set rsqdb = server.CreateObject("ADODB.Recordset")
Conn.open "Provider=sqloledb;Server=myserver;Initial Catalog=qdb;UID=Reports;PWD=pw;"
set rsqdb = conn.Execute ("SELECT ParentEventID, KPName FROM Object " )

if rsqdb.EOF then
 Response.Write "There are no events"
 Response.End
end if
%>

<html>

<table>
  <td><font face="Verdana" size=1>
   <input id="kpname" name="kpname" value="<%response.write rsqdb("kpname")%>">
  </td>
  <td><font face="Verdana" size=1>
        <a href="test5.asp?parenteventid=<%response.write rsqdb("parenteventid")%>">
        <%response.write rsqdb("ParentEventID")%></a>
  </td>
 </tr>
  <%rsqdb.MoveNext%>
  <%loop%>

</table>
</html>

<%do while not rsqdb.EOF%></do>
<%response.write rsqdb("name")%>
<%response.write ("<br> ")%>
<%rsqdb.MoveNext%>
<%loop%>

<%
set rsqdb = nothing
set conn = nothing
%>
submit.asp - This file attempts to pass the kpname form the query and open a Remedy ticket. Note: When I run submit.asp as a standalone file (with dummy information), it generates a Remedy ticket.

Code:
<%
Response.Buffer = false
Dim kpname, parenteventid
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "'")
End Function
kpname = ChkString(Request.QueryString("kpname"))
parenteventid = ChkString(Request.QueryString("parenteventid"))
set Conn=Server.CreateObject("ADODB.Connection")
Conn.open "Provider=sqloledb;Server=myserver;Initial Catalog=qdb;UID=Reports;PWD=pw;"

mysql = "SELECT ParentEventID, AgentMsgShort, KPName from Object " _
& " where parenteventid = '" & Request.QueryString("parenteventid") &"' ")

Set RS = conn.execute (mysql)
Set WShell = CreateObject("WScript.Shell")
wshell.run "D:/InCharge8T2/SAM.Adapters/smarts/bin/sm_arclient.exe --server=""52tdkp-CMDB-001"" --user=""dalesmarts"" --password=""dalesmarts"" createEntry ""InCharge SAM Schema""  2 c ""smarts"" 7 e 1  8 c  " & KPname & "  1042601003 c ""Server"" 1042601004 c ""52VEJX-AM-004"" 1042601007 d ""Paging File Usage High; Paging File Usage% is 98.84; >TH = 95"" "
Set WShell = nothing
response.write "Submitted Remedy Ticket"
if rs.EOF then
Response.Write "There is no data"
Response.End
end if
%>
However, there are two problems I'm having:

1. When I click the hyperlink in events.asp (which calls submit.asp), the executable doesn't run. Note: I've left some dummy data in the call along with my attempt to pass the KPName data from the query.

2. I'm not sure that the KPName syntax is correct.

Any help is appreciated.

Dale





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing parameters fizzerchris Access VBA 5 August 31st, 2007 12:16 PM
Passing parameters tal Ajax 5 May 26th, 2007 08:07 AM
Passing parameters ceema Crystal Reports 0 February 15th, 2006 04:03 AM
Passing Parameters spraveens Javascript 5 October 8th, 2003 07:06 AM
passing parameters spraveens Javascript How-To 1 October 8th, 2003 03:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.