[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

XMLHTTP Post

Posted on 2006-03-20
3
Medium Priority
?
311 Views
Last Modified: 2006-11-18
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"-->
0
Comment
Question by:padgettbrian
  • 2
3 Comments
 

Author Comment

by:padgettbrian
ID: 16239816
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))

0
 
LVL 8

Accepted Solution

by:
esw074 earned 2000 total points
ID: 16240179
Pass the "client" value to the client-side script and then include it with the insert:

Dim myhttp
datatosend="printers=" & strPrinters & "&client=" & "<% = client %>"
Set myhttp=CreateObject("Msxml2.XMLHTTP")
myhttp.open "POST", "test.asp", false
myhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
myhttp.send datatosend
set myhttp = Nothing

0

Featured Post

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.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 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