#!/usr/bin/perl -w use strict; use DBI; # requires installing perl module DBD::ADO # and microsoft ole db driver for foxpro - avialable from microsoft developer website my $connect_string = 'Provider=VFPOLEDB.1;Data Source=C:\foxpro\folder;Mode=ReadWrite|Share Deny None;Password="";Collating Sequence=MACHINE'; # ADO Connection String my $dbh = DBI->connect("dbi:ADO:$$connect_string") or die("Can't connect: $DBI::errstr"); # note: haven't been able to figure out using placeholders yet, or if it is even supported - i.e. "select * from table where id = ?" # table in this statement is your dbf file, i.e. table.dbf my $sth = $dbh->prepare("select * from table where date between {d '2008-08-01'} and {d '2008-08-16'} order by date") or die( "Database Error: $DBI::errstr" ); $sth->execute() or die( qq(Database Error: $DBI::errstr) ); while (my $r = $sth->fetchrow_hashref) { # do stuff with $r->{column_name}, etc. # helpful note: @{$r->{NAME}} works with foxpro/ado connection - gives you an array of the table column names } $sth = $dbh->prepare("insert into table (column1,column2,date) values ('Hi','There',{^2008-08-16})") or die( "Database Error: $DBI::errstr" ); $sth->execute() or die( qq(Database Error: $DBI::errstr) ); # notice the difference in date formats for select and insert - took me a while to figure that out # if you have foxpro tables that rely on indexes, you can select just fine # and you can insert, but I don't know how to update the index file # anyone else know? $sth->finish; $dbh->disconnect; exit;