Hiya. I'm using Access2000 and DBI::ODBC. I'm trying to insert into a table
called Volunteers, and I continually get this error:

--------------
Died while executing:<br>[Microsoft][ODBC Microsoft Access Driver] Data type
mismatch in criteria expression. (SQL-22005)(DBD: st_execute/SQLExecute
err=-1)<hr> at c:\inetpub\wwwroot\EBA\cgi-bin\edit_volunteers.pl line 472.
--------------

I don't understand what data type is incorrect though.

There are only 2 fields which have a specific criteria:
        1) Confirmed: "Yes" or "No
        2) Position: maaaany different options, including "Undetermined"

There are only 2 fields which are not of type "text":
        1) VolunteerID: Number
        2) TeamNum: Number

So, I'm thinking that if the error *is* a "data type mismatch", it has to be
with one of the above 4 fields...However, I printed out the data that I'm
inserting, and this is it (ignore the square brackets):

VInfo[VolunteerID] = [8]
VInfo[Fax] = []
VInfo[Name] = [Big Bird]
VInfo[TeamNum] = []
VInfo[Position] = [Undetermined]
VInfo[Phone] = [777-7777]
VInfo[Email] = []
VInfo[Action] = [insert]
VInfo[Confirmed] = [Yes]

>From what's being inserted, I really can't see any problems:
        -Confirmed is getting a "Yes"
        -Position is getting an "Undetermined"
        -VolunteerID is getting an 8
        -TeamNum is getting nothing (and this field isn't required)

Might anyone know what I might be doing wrong?

Here's how I insert:

#insert the new volunteer
$sth = $dbh->prepare("INSERT INTO Volunteers
                (
                VolunteerID,
                TeamNum,
                Name,
                Phone,
                Fax,
                Email,
                Position,
                Confirmed
                )
        VALUES (?, ?, ?, ?, ?, ?, ?, ?)") || die "Died while
preparing:<br>$DBI::errstr<hr>";

$sth->execute
        (
        $VolunteerInfo{'VolunteerID'},
        $VolunteerInfo{'TeamNum'},
        $VolunteerInfo{'Name'},
        $VolunteerInfo{'Phone'},
        $VolunteerInfo{'Fax'},
        $VolunteerInfo{'Email'},
        $VolunteerInfo{'Position'},
        $VolunteerInfo{'Confirmed'}
        )  || die "Died while executing:<br>$DBI::errstr<hr>";

Note that the error says "Died while executing", which means that the actual
SQL syntax is (supposedly) okay...

Anyways, if anyone has any suggestions, I'd really appreciate it.

Thanks!
        Nick

Reply via email to