Link to home
Start Free TrialLog in
Avatar of padgettbrian
padgettbrian

asked on

XMLHTTP Post

EXPERTS,

I have a vbscript below that I need to run on the client then post to another page using XMLHttp, can you please help me figure out the XMLHttp part. I need to figure out what I need to add to this page and what needs to be on the sequent page to then insert the data into the DB.

THANKS



----------------------------------------------------------------------------------------

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="dstlstLabel.asp"-->
<!--#include file="../Include/InitSysData.asp"-->
<!--#include file="../Include/C850_Format_date_V1.asp"-->
<%
prmPageSize=0
Action = Request("Action")
Dim prmReturn(0)
prmReturn(0)="DEST_ID"
Dim prmValue(9)
Dim prmWhere(8)
prmWhere(0)="DEST_ID NOT LIKE '*******%*'"
Dim prmOrder(4)
prmOrder(0)="DEST_ID ASC"
prmOrder(1)="DEST_LOC_DESC ASC"
Dim HCPR_STATUS                
Dim rsGCTD
Dim Csik_table_id
Dim Csik_code
Dim Csik_Rcpt_Rtv_Id
'
' set up and get switch from GCVMNT with HCSW for CLIENTPRNT
'
Csik_Table_id = "HCSW"
Csik_code = "CLIENTPRNT"
sql = "SELECT"
sql = sql & " code_status"
sql = sql & " FROM GCTD"
sql = sql & " WHERE table_id = '" & CSIK_TABLE_ID & "'"
sql = sql & " and code = '" & csik_code & "'"
ControlDBConnection = Application("ControlDBConnection")
Call Open_ADO_Connection(Conn, ControlDBConnection)
Set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open sql, Conn, adOpenForwardOnly, adLockReadOnly
If Not (rs.EOF) Then
    HCPR_STATUS = CobraStr(rs("CODE_STATUS"))
    Call csiDestroyRecordSet(rs)
End If
'
' test switch from above and if "A" then run script and insert printers into prnt table
'
if HCPR_STATUS = "A" then
  '
  ' set up to get next client id from value of Oracle sequence csi_seq_client
  '
  dim rs2
  dim client
  sql = "select csi_seq_client.nextval from dual"
  Set RS2 = Server.CreateObject("ADODB.RecordSet")
  RS2.Open sql, Conn, adOpenForwardOnly, adLockReadOnly
  client = CobraStr(rs2(0))
%>
   <script language="vbscript">
  Option Explicit
 
  If <%=HCPR_STATUS%>="A" Then
 
  Dim strComputer, objWMIService, colInstalledPrinters, objPrinter
  Dim objNetwork
  Dim strPrinters
  'msgbox("hello")
  Set objNetwork = CreateObject("WScript.Network")
  'Get the printer collection
  strComputer = "."
  Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer")
  strPrinters = strPrinters & "<?xml version=""1.0"" standalone=""yes""?>"
  strPrinters = strPrinters & "<InstalledPrinters>"
  For Each objPrinter in colInstalledPrinters
    If(inStr(objPrinter.Name,"\\") > 0) Then
      Conn.execute("insert into hcpr values(" & client & ",'" & objPrinter.Name & _
        "',DECODE(" & objPrinter.Default & "'FALSE',' ','DEFAULT')")
    end if
  Next
  End If
  '
  ' insert 2 dummy values into Oracle table HCPR just for testing
  ' Do a "select * from HCPR" in cmbsperfsrv01 demo2 to check
  '
  'Conn.execute("insert into hcpr values(" & client & ",'\\ps02\4e3x','Default')")
  'Conn.execute("insert into hcpr values(" & client & ",'\\ps02\4e4x','')")
  '
  </script>
<%
  'call getprtr(client)
  '
  RS2.close
  Set RS2 = Nothing
  '
  ' CUSTOM CODE - set up sql statement to send to "prompt"
  '
  prmSql="SELECT printer_id, default_flag FROM hcpr"
  prmWhere(0)="session_id = " & client
  prmOrder(0)=""
  prmOrder(1)=""
'
'  Response.write " pre del"
'  Conn.execute("delete from hcpr where session_id = " & client)
'  Response.write " del done"
'
else
  '
  ' STANDARD CODE - set up sql statement to send to "prompt"
  '
  prmSql="SELECT DEST_ID, DEST_LOC_DESC FROM DSTM"
end if
%>
<!--#include file="../Include/Prompt.asp"-->
Avatar of esw074
esw074

Avatar of padgettbrian

ASKER

I also need to pass the value of the variable to the next page. How do you pass this var to the next ASP page?

client = CobraStr(rs2(0))

ASKER CERTIFIED SOLUTION
Avatar of esw074
esw074

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial