Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: simple question about printing sql 2000 error messageby gmax (Abbot) |
on Oct 07, 2003 at 06:59 UTC ( [id://297216]=note: print w/replies, xml ) | Need Help?? |
The best way of catching errors in a DBI operation is through eval.
Notice that RaiseError must be on, to be sure it will raise an exception in case of error. The DBI docs have all the details of this procedure. I believe you would benefit from a walk through our Tutorials about database programming. Start with this one. As a side note, instead of using "INSERT INTO t1 (lsname) VALUES ('$lsname')"; consider the placeholder mechanism, which will make sure that your field is properly quoted.
In Section
Seekers of Perl Wisdom
|
|