in reply to Re^2: Inserting values into MS Access
in thread Inserting values into MS Access

Since only one record is inserted, my first suspicion is that the second item you try to insert is bad in some way, hence the need for the more detailed debugging above (especially the print'ing of $sql -- what does that show? if you paste directly into access does it work?)

My second suspicion is that the nested Sql() call is destroying the outer recordset (which is also consistent w/your 1-insert observations). To validate this, rework your code to something like this:
my @data; while ($EDS_DB->FetchRow()){ my %data = $EDS_DB->DataHash(); push @data, \%data; } # if @data doesn't have > 1 element here, check $EDB_DB->Error for the + reason foreach my $data (@data){ my $sql = sprintf "INSERT INTO Servers (Server_Name) VALUES ('%s')", + $data->{Server_Name}; warn "SQL: " . $sql; my $rc = $EDS_DB->Sql($sql); warn "Return Code: '$rc'"; warn "Error String: " . $EDS_DB->Error; }

Replies are listed 'Best First'.
Re^4: Inserting values into MS Access
by blackadder (Hermit) on Jun 06, 2005 at 21:16 UTC
    Indeed, I can definitly see the value in this code. In fact I will try this code first to see if there are any problems with my source data....

    I will post the error, because I did get some, if i remember correctly!!!

    Humbled with your knowledge Sir....Thanks very much.
    Blackadder