Expand|Select|Wrap|Line Numbers
- use DBI;
- my $dbh;
- sub initialise {
- #open connection to Access database
- $dbh = DBI->connect("dbi:ODBC:TheatreWol", {AutoCommit => 1}) || die "Couldn't connect to DB\n";
- }
- initialise();
- print "Enter command (search, quit): ";
- $opt = <STDIN>;
- chomp($opt);
- while ($opt ne "quit") {
- if ($opt ne "search") {
- print "Invalid option - (search, quit):";
- $opt = <STDIN>;
- chomp($opt);
- next;
- }
- #prepare and execute SQL statement
- $sqlstatement="SELECT * FROM TheatreWol2007Presentations WHERE startdate=2007-02-01";
- $sth = $dbh->prepare($sqlstatement);
- $sth->execute || die "Could not execute SQL statement ... maybe invalid?";
- #output database results
- while (@row=$sth->fetchrow_array)
- { print "@row\n" }
- print "Enter command (search, quit): ";
- $opt = <STDIN>;
- chomp($opt);
- }
DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. (SQL-07002?)(DBD: st_execute/SQLExecute err=-1) .
Any help would be greatly appreciated.