Hi,
Have you read this page?
I think you will find the answer here.
Hope this helps,
Cheers,
Martin | [reply] |
Not trying to deflect your question, but do you gain anything from using the MSSQL:SQLLib over say... DBI? DBI is database independant, so if you ever had to transition this code to another platform, the work would be minimal, compared to re-writing it from a platform specific module like you're using. I'm not trying to be a DBI zealot at all. DBI has just worked really well for me in MySQL,Oracle, and MSSQL.
<edit>
Since I was babbling about it I thought I would expand on the fact that DBI is an interface, and you need the database driver DBD::ODBC to use it with DBI. Check the POD on them, and there are some good examples of how to get something up and running.
</edit>
| [reply] [d/l] |
Since I posted this, I have started experimenting with DBI and have found that it would make sense to use this method.
Once again, thanks to all Monks that replied..
Danny
| [reply] |
Grygonos,
Do I have to specify use DBD::ODBC after the use DBI statement ?
After reading various help pages on DBI/DBD, I thought that the DBI module loaded the appropriate DBD part on connect.
Thanks
| [reply] |
use DBI;
my $dbh = DBI->connect('DBI:ODBC:driver=SQL Server;database=mydb;serve
+r=myserver;app=myapp',$username,$password);
| [reply] [d/l] |
Update: Whoops, my bad, that'll teach me not to read the question properly. VSarkiss is correct and thanks for pointing it out :)
my $sth = $dbh->prepare("SELECT * FROM $table");
$sth->execute;
while (my $array_ref = $sth->fetch) {
#
#do something
#
}
And if you're not you should probably check that your query executes too :)
----------
My cow-orkers were talking in punctuation the other day. What disturbed me most was that I understood it.
| [reply] [d/l] |
| [reply] |