Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

insert into mssql table

by nathanvit (Beadle)
on Feb 02, 2005 at 10:56 UTC ( [id://427205]=perlquestion: print w/replies, xml ) Need Help??

nathanvit has asked for the wisdom of the Perl Monks concerning the following question:

Hello guys, i'm searching to insert a record in a table inside a MSSql server database.
I've understood where is the error but i can't understand how to resolve it...
I start with a CGI:
$q = new CGI; print $q->header, ...
If i put the code (i've put below) before or after the "print" i can insert the record inside the table. On the contrary, and this is my problem, if i put the code inside the "if(param())" block, it doesn't insert anything...
May someone can help me please?
$dbh = DBI->connect('dbi:ODBC:fax',$user, $passwd, { RaiseError => 1, AutoCommit => 1 }) or die "Non riesco a connettermi +!!\n"; $in=$dbh->prepare("INSERT INTO $tabella(NumPratica) VALUES ('3456337') +;"); $in->execute(); $dbh->disconnect();

Replies are listed 'Best First'.
Re: insert into mssql table
by gellyfish (Monsignor) on Feb 02, 2005 at 11:05 UTC

    Perhaps param() isn't returning a true value. You can either print out the parameters before you reach the conditional to see whether they contain what you expect, or replace the conditional with  if (1) for debugging purposes.

    /J\

Re: insert into mssql table
by mkirank (Chaplain) on Feb 02, 2005 at 11:53 UTC
    I recommend some Error-checking after prepare and execute
Re: insert into mssql table
by sasikumar (Monk) on Feb 02, 2005 at 12:58 UTC
    Hi,

    Try to look at the error logs and send as the error that would help us.
    If the code looks like this
    if (param()) {

    Then change it as
    if ($q->param()) {

    Thanks
    SasiKumar
      hello, i've tried to put
      if ($q->param()) { or if (1) {
      but nothing happens in the table.
      How can i see errors?
      It doesn't seem to produce errors. What parameters have i to set?
Re: insert into mssql table
by kprasanna_79 (Hermit) on Feb 02, 2005 at 13:24 UTC
    Hey
    Y can t u just post the error_log so that it will be easy to debug exactly.
    --prasanna.k

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://427205]
Approved by pelagic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-29 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found