Hi,
I am trying to open a database connection and having a problem--it will NOT
open.
Here is the code that I am using.
# security is the name of the database.
#user_data is the name of the access table
$path = $Server->MapPath("security.mdb");
$data = "driver={Microsoft Access Driver (*.mdb)};database=" . $path;
$Conn = $Server->CreateObject("ADODB.Connection");
# above goes fine
# then next line dies
$Conn->Open($data) || die "Cannot Open";
$RS = $Conn->Execute("SELECT * FROM user_data" );
If I leave out the "|| die statement",
when I try to access the Fields method with this code
foreach my $field (Win32::OLE::in($RS->Fields)) {
I get this
"Can't call method "Fields" on unblessed reference."
Now, I know the driver is good because the following vbscript code Works
!!!.
data_source = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
Server.MapPath("data/security.mdb")
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
Anyone have any idea what I am doing wrong??
You help would be appreciated.
Thanks,
Thomas Whitney
Just for misc. informatinon
Ths following is from the MSDN ADO docs on the OPEN method
' Open a connection without using a Data Source Name (DSN)
Set Cnxn1 = New ADODB.Connection
Cnxn1.ConnectionString = "driver={SQL
Server};server=srv;uid=sa;pwd=pwd;database=Pubs"
Cnxn1.ConnectionTimeout = 30
Cnxn1.Open
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]