Good day all,
Please may you assist me with the following:
I have a script that executes a SP and I get results with 5 rows and a number of columns.
How can I execute the SP with a WHERE statement to result a value from a specific row?
I use the SP to populate a drop down list, when I select the value I want to get information from a certain column from the row of the selected item.
Please see the code below which works but results with values from the first row. This is why I think a WHERE would work? Am I correct with this?
'This script is used to popluate the Server/Database picklist
Option Explicit
dim objConn, conStr, par1, rs, result, command, fields, value, nameset objConn = CreateObject("ADODB.command")
Const adParamInput =1Const adVarChar =200
conStr ="Provider=..."
set par1 = CreateObject("ADODB.Parameter")
par1.Direction=adParamInput par1.name="@CompanyID" par1.Size=50 par1.Type=adVarChar par1.Value="1"
With objConn.activeconnection = conStr.commandtype =4.commandtext ="sp_AW_Select_Remote_Sites".Parameters.Append par1 .ExecuteEndwith
'Testing the results of a field from the selection aboveset rs = CreateObject("ADODB.Recordset") rs.open objConnIFNOT RS.EOF THEN result = RS("DBCatalog")' Metadata.Values("INVOICEDATE") = RS("InvoiceDate")' Metadata.Values("CUSTOMERNAME") = RS("CustomerName")' Metadata.Values("MY_OUTPUTFOLDER") = "C:\Scans\M-Files Integrate\InvoiceWithBarcode\"ELSE' Metadata.Values("INVOICEAMOUNT") = "NOT_FOUND"' Metadata.Values("INVOICEDATE") = "NOT_FOUND"' Metadata.Values("CUSTOMERNAME") = "NOT_FOUND"' Metadata.Values("MY_OUTPUTFOLDER") = "C:\Scans\M-Files Integrate\InvoiceWithBarcode Rejects"ENDIF RS.Close wscript.echo result
Thank you,
Regards,