Problem:
I am unable to insert into a table. I have no problem querying the database, but for some reason I am unable to insert into it. When I try to execute the SQL that prints out, Access asks me to append the table, and all is good. Any ideas why I am missing something?
The primary key is AutoNumber called GameID. But I don't think I need to say anything with respect to this in the Insert.
All help is appreciated.
CODE:
if (!$conn = new COM("ADODB.Connection"))
exit("Unable to create an ADODB connection<br>");
$strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("courtside.mdb");
$conn->open($strConn);
$strSQL =" Insert into Game (LeagueID, CourtID, HomeTeamID, VisitorTeamID, HomeScore, VisitorScore, GameTime) ";
$strSQL .=" values(\"$LeagueID\", \"$CourtID\", \"$HomeTeamID\", \"$VisitorTeamID\", \"$HomeScore\", \"$VisitorScore\", \"$GameDate\")";
echo "$strSQL";
#echo "<hr>";
$rs = $conn->execute($strSQL);
OUPTUT
Insert into Game (LeagueID, CourtID, HomeTeamID, VisitorTeamID, HomeScore, VisitorScore, GameTime) values("1", "1", "1", "32", "523", "32", "9/1/2009")
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4. in