PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Automation issue (OLE)  (Read 845 times)

michaelgreer

  • Diamond Member
  • *****
  • Posts: 129
    • View Profile
Automation issue (OLE)
« on: August 02, 2021, 10:43:37 AM »
I am trying to duplicate this VBS script in PxPlus:

strSLXCon = "Provider=SLXOLEDB.1;Password=password;Persist Security Info=True;User ID=admin;Initial Catalog=FACTSCONNECTION;Data Source=IP-SQL;Extended Properties=PORT=1706;LOG=ON;CASEINSENSITIVEFIND=ON;AUTOINCBATCHSIZE=1;SVRCERT=;"
Set objSLXCon = CreateObject("ADODB.Connection")
objSLXCon.Open strSLXCon
Set objSLXRS = CreateObject("ADODB.Recordset")

strSQL = "slx_dbids('Account',1)"
objSLXRS.Open strSQL, objSLXCon


        objSLXRS.Movefirst
        strID = objSLXRS.Fields(0)
         objSLXRS.close

msgbox strID

Here is my code:

1000 !
1005 def object crm,"ADODB.Connection"
1007 def object rec,"ADODB.Recordset"
1010 constr$="Provider=SLXOLEDB.1;persist security info=True;Initial Catalog=FACTSCONNECTION;PASSWORD=password;user ID=admin;Data Source=IP-SQL;EXTENDED PROPERTIES=""PORT=1706;log=on;casesensitivefind=on;autoincbatchsize=1;SVRCERT="""
1015 crm'open(constr$)
1020 idsql$="slx_dbids('Account',1)"
1025 ! id$=crm'execute$(idsql$)
1030 ! print id$
1035 rec'open(idsql$,*crm)
1040 rec'movefirst()
1045 id$=rec'fields$(0)
1050 print id$
1080 drop object crm
1085 drop object rec

I do not get the same result as the VB script which does return the correct value. My code executes, but generates a completely different set of ID's.  Any pointers on what is wrong here?