Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 28058

Passing Parameters to Executable

$
0
0

 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.

<%
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 " )
%>
<html>
<table>
  <td><input id="kpname" name="kpname" value="<%response.write rsqdb("kpname")%>"></td>
  <td>
        <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.

 <%
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

 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 28058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>