Created
October 11, 2018 00:39
-
-
Save beargolightly/2a3ad4047351124e0413028c321064ad to your computer and use it in GitHub Desktop.
extremely dirty Powershell script to read data from a free-tables DBF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # this is a quick and dirty proof-of-concept of reading our specific DBF files from Powershell | |
| # WARNINGS: | |
| # 1. you have to have the foxpro OLE DB 32-bit version installed | |
| # 2. you have to run this w/ the 32-bit version of powershell | |
| # 3. 'exclusive=no' may not be right for you | |
| # 4. π DONT π USE π FOXPRO π ANYMORE π | |
| # I don't know what Powershell will do will all those emojis and I'm not going to find out | |
| $ConnString = "Provider=vfpoledb;Data Source=h:\;Extended Properties=dBASE IV;exclusive=no" | |
| $Conn = new-object System.Data.OleDb.OleDbConnection($ConnString) | |
| $Conn.open() | |
| $cmd = new-object System.Data.OleDb.OleDbCommand("select * from errorlog2 where day(date)=day(datetime()) and month(date)=month(datetime()) and year(date)=year(datetime())",$Conn) | |
| $da = new-object System.Data.OleDb.OleDbDataAdapter($cmd) | |
| $dt = new-object System.Data.dataTable | |
| $da.fill($dt) | |
| $dt|select date, message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment