This is hard to explain but I will try my best.
I have a script that reads a database file and it works properly with this line.
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp;Extended Properties='text;HDR=NO;FMT=Delimited;Option=1'
I want the user to be able to edit it so I saved it as a text file so it could be read. It is read correctly but when the program is run it fails so in debuging I entered this in my code:
MDL>ConStr
Let>ConStr=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%datapath%;Extended Properties='text;HDR=NO;FMT=Delimited;Option=1'
MDL>ConStr
and this was returned:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%datapath%;Extended Properties='text;HDR=NO;FMT=Delimited;Option=1'
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp;Extended Properties='text;HDR=NO;FMT=Delimited;Option=1'
What I want to do is have %datapath% updated to conatin the value in the variable %datapath% not the literal %datapath%
Reading text file as code
Moderators: JRL, Dorian (MJT support)
Figured it out
I got it running by the following:
Let>VAREXPLICIT=1
//MDL>%ConStr%
//Let>ConStr=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%datapath%;Extended Properties='text;HDR=NO;FMT=Delimited;Option=1'
//MDL>ConStr
DBConnect>%ConStr%,dbH
Let>SQL=select * from %datafile%
Let>VAREXPLICIT=0
DBQuery>dbH,SQL,fields,num_recs,num_fields
Let>VAREXPLICIT=1
//MDL>%ConStr%
//Let>ConStr=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%datapath%;Extended Properties='text;HDR=NO;FMT=Delimited;Option=1'
//MDL>ConStr
DBConnect>%ConStr%,dbH
Let>SQL=select * from %datafile%
Let>VAREXPLICIT=0
DBQuery>dbH,SQL,fields,num_recs,num_fields