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"-->
padgettbrianAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

padgettbrianAuthor Commented:
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
esw074Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.