I've gotten though the process of creating my table dynamically.  Now, I 
am having problems with inserting data into the Memo fields, even 
when I am using bind-param.  Can anyone figure out what my problem 
is from my code below?  Again, I am creating and adding data to an 
Access database, using ODBC.  Thanks in advance.

<code below>

foreach $i (1..$in{'no_questions'}) {
        push @questions, ",question_"."$i"."             LONGCHAR,".
                                          "question_"."$i"."_type        
VARCHAR(50),".
                                          "question_"."$i"."_answers 
LONGCHAR,".
                                          
"question_"."$i"."_values        LONGCHAR,".
                                          "question_"."$i"."_private 
BIT";
}

my $dbh = DBI->connect('dbi:ODBC:armsreach_reporting') || die 
DBI::errstr;
my $sth = $dbh->do("CREATE TABLE $in{'report_name'} (sid        
                COUNTER,
                                                                
                                 report_name    VARCHAR(64),
                                                                
                                 creator                
VARCHAR(255),
                                                                
                                 creation_date  DATE,
                                                                
                                 abstract               LONGCHAR,
                                                                
                                 instructions   LONGCHAR,
                                                                
                                 no_questions   INTEGER
                                                                
                                 @questions
                                                                
                      )
                   ");
$dbh->disconnect;

foreach $i (1..$in{'no_questions'}) {
        push @results, ",question_"."$i"."                 
LONGCHAR,"    .
                                        "question_"."$i"."_type    
VARCHAR(50)," .
                                        "answer_"  ."$i"."      
           LONGCHAR,"    .
                                        "question_"."$i"."_values  
LONGCHAR,"    .
                                        "question_"."$i"."_private BIT";
}

my $dbh = DBI->connect('dbi:ODBC:armsreach_reporting_results') || 
die DBI::errstr;
my $sth = $dbh->do("CREATE TABLE $in{'report_name'} (sid        
                COUNTER,
                                                                
                                 report_name    VARCHAR(64),
                                                                
                                 creator                
VARCHAR(255),
                                                                
                                 creation_date  DATE,
                                                                
                                 no_questions   INTEGER
                                                                
                                 @results
                                                                
                      )
                   ");
$dbh->disconnect;

my $dbh = DBI->connect("dbi:ODBC:armsreach_reporting") || die 
DBI::errstr;
my $sth = $dbh->prepare("INSERT INTO $in{'report_name'} (
                                                                
         report_name, creator, creation_date, abstract, instructions, 
no_questions)
                         VALUES (?,?,?,?,?,?)
                        ") || die DBI::errstr;

$sth->bind_param(1,$in{'report_name'},SQL_LONGVARCHAR);
$sth->bind_param(2,$in{'creator'},SQL_LONGVARCHAR);
$sth->bind_param(3,$in{'creation_date'},SQL_LONGVARCHAR);
$sth->bind_param(4,$in{'abstract'},SQL_LONGVARCHAR);
$sth->bind_param(5,$in{'instructions'},SQL_LONGVARCHAR);
$sth->bind_param(6,$in{'no_questions'},SQL_LONGVARCHAR);

$sth->execute();
$dbh->disconnect();

<code above>

Brad Smith

Reply via email to