Hi mk-soft,
is there any way I can use the 32bit version of the scripting host?
I'm trying the following VBS code, that I found online, to access a Microsoft Access accdb file.
Code: Select all
Set conn = CreateObject("ADODB.Connection")
' Connect to the database
strConnect = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\Users\User\Desktop\Database1.accdb"
conn.Open strConnect
MsgBox conn
StrSQL = "Select * from Tabelle1"
Set rs = conn.Execute(StrSQL)
Do While Not rs.EOF
MsgBox "Spalte1:" & rs.Fields("Spalte1") & " Spalte2:"& rs.Fields("Spalte2")
rs.MoveNext
Loop
Here's the PB-Code using your include:
Code: Select all
IncludeFile "ActiveScript.pbi"
vbs.s = "" +
~"Set conn = CreateObject(\"ADODB.Connection\")"+#CRLF$+
~"' Connect to the database"+#CRLF$+
~"strConnect = \"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\\Users\\User\\Desktop\\Database1.accdb\""+#CRLF$+
~"conn.Open strConnect"+#CRLF$+
~"MsgBox conn"+#CRLF$+
~"StrSQL = \"Select * from Tabelle1\""+#CRLF$+
~"Set rs = conn.Execute(StrSQL)"+#CRLF$+
~"Do While Not rs.EOF"+#CRLF$+
~" MsgBox \"Spalte1:\" & rs.Fields(\"Spalte1\") & \" Spalte2:\"& rs.Fields(\"Spalte2\")"+#CRLF$+
~" rs.MoveNext"+#CRLF$+
~"Loop"
*Control = ActiveScript::NewActiveScript()
If *Control
ActiveScript::ParseScriptText(*Control, vbs)
ActiveScript::FreeActiveScript(*Control)
EndIf
Okay, so this VBS-code does not actually work on my machine (says the Provider can not be found) and here is why:
https://social.technet.microsoft.com/Fo ... forum=ITCG
The comments there said to use a 32bit scripting host
From a 32 bit prompt:
cscript yourfile.vbs
From a 64 bit prompt:
c:\windows\SysWow64\cscript yourfile.vbs
And NOW, it does indeed work, using the line with the SysWow64 directory.
Is there any way I can do this with your Active Script?
I tried messing about with this part here, exchanging the x86 for the x64 data. But then it did nothing at all.
Code: Select all
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
IID_IActiveScriptParse: ; {BB1A2AE2-A4F9-11CF-8F20-00805F2CD064} 32 bit
Data.l $BB1A2AE2
Data.w $A4F9, $11CF
Data.b $8F, $20, $00, $80, $5F, $2C, $D0, $64
CompilerEndIf
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
IID_IActiveScriptParse: ; {C7EF7658-E1EE-480E-97EA-D52CB4D76D17} 64 bit
Data.l $C7EF7658
Data.w $E1EE, $480E
Data.b $97, $EA, $D5, $2C, $B4, $D7, $6D, $17
CompilerEndIf
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
IID_IActiveScriptSiteDebug: ; {51973C11-CB0C-11D0-B5C9-00A0244A0E7A} 32 bit
Data.l $51973C11
Data.w $CB0C, $11D0
Data.b $B5, $C9, $00, $A0, $24, $4A, $0E, $7A
CompilerEndIf
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
IID_IActiveScriptSiteDebug: ; {D6B96B0A-7463-402C-92AC-89984226942F} 64 bit
Data.l $D6B96B0A
Data.w $7463, $402C
Data.b $92, $AC, $89, $98, $42, $26, $94, $2F
CompilerEndIf
Any help would be greatly appreciated. I'm trying for days to get data from an Access-file and nothing seems to work.
Thanks
