I wish I could be more help. I do very little in Win OSs, recently. I live in the UNIX/Apache world for the most part, now.
My best, but limited, advice would be to break the situation down into basic chunks of functionality and make each one work. I don't know anymore detail and don't have Access to play with to figure it out.
First, setup your ODBC data source on the machine (web server box) that is trying to run the code and make the ODBC connection. The Win OS should tell you if it can not attach the data source name to the Access file.
Second, use EXCEL or ACCESS or similar to fire a query at that ODBC data source. Make this work. There is no reason to do anything else until you have the much working on the web server box.
Third, write a very short piece of Perl to make a connection. Something like.....
Code:
#!perl
# trying to connect to stagesrv with PERL DBD::ODBC
use Win32::ODBC;
print "Trying to connect\n";
$db = new Win32::ODBC("
[red]DSN=sqlServer;UID=someone;PWD=test[/red]
Code:
")
or die Win32::ODBC::Error();
if ($db) { $db->Close(); }
print "Closed db handle\n";
Fourth, get a simple cgi app to connect with something like....
Code:
#!perl
use CGI;
use Win32::ODBC;
$cgi = new CGI;
print $cgi->header,$cgi->start_html;
print "<P>Trying to connect<BR>\n";
$db = new Win32::ODBC("
[red]DSN=sqlServer;UID=someone;PWD=test[/red]
Code:
") ;
if ($error = Win32::ODBC::Error())
{
print "ERROR - $error<BR>\n";
print $cgi->end_html;
die;
}
else
{
print "Yea! It worked. Connection Successful<BR>\n";
if ($db) { $db->Close(); }
print "Closed db handle<BR></P>\n";
print $cgi->end_html;
}
Fifth, install the working logic into the piece of code you are working on.
I have not run the above code. They should be pretty close. Obviously, change you connect parameters to match you datasource.
HTH
Good Luck.
keep the rudder amid ship and beware the odd typo