CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
dbi error

 

First page Previous page 1 2 Next page Last page  View All


wayko621
Novice

May 22, 2002, 7:27 AM

Post #26 of 28 (4223 views)
Re: [wayko621] dbi error [In reply to] Can't Post

no post :(

i think this isn't meant to be

i guess i have to try coldfusion or something else i know

i was hoping to be able to do it this way but :(


INS
New User

Aug 28, 2002, 7:49 PM

Post #27 of 28 (3906 views)
Re: [wayko621] dbi error [In reply to] Can't Post

This might be late, and I'm still new at Perl and DBI, but the only error I see is at the begining and the end of the following cut and paste code:



$address = $field{'address'};
$email = $field{'email'};
$phone = $field{'phone'};
$user = $field{'user'};
$pass = $field{'pass'};

use DBI;
$DSN = 'driver=Microsoft Access Driver (*.mdb);
dbq=\\$c\\inetpub\\wwwroot\\DreamCpu.mdb';
my $dbh = DBI->connect("dbi:ODBC:$DSN", '','') || die "Can't connect to database: $DBI::errstr";




print "Content-Type: text/html\n\n";
print"<html><body><h1>this is a test</h1>";
$sql = qq{INSERT INTO Dreamcpu (FirstName,LastName,Address,Email,Phone,Username,Password) VALUES ('$first','$last','$adress','$email','$phone','$user','$pass');};



Shouldn't $adress in the variable passed be $address, like declaired in the begining?


thebitch
User

Aug 29, 2002, 3:43 AM

Post #28 of 28 (3904 views)
Re: [wayko621] dbi error [In reply to] Can't Post

I think that DSN there is wrong.
I personally never used DSN's like that.
As per the reccomendation of the DBD::ODBC
pod, I like to set up a system DSN
using the ODBC manager under win32

on win2000, it's (just file find for odbc*.cpl)
start > run > odbccp32.cpl

anyway, what I think the DSN should be is


Code
 
my $DSN = "dbi:ODBC:";
$DSN .= "Driver={Microsoft Access Driver (*.mdb)};";
$DSN .= "Dbq=c:\somepath\mydb.mdb;";
$DSN .= "Uid=admin;Pwd=;"; # just in case u need it

It is a very common error to forget the {} part in
Driver={}

Anyway, that should solve your problem.
Don't think that I remembered this (i've used it before),
but what I did was search google.com
for ODBC DSN and came up with
http://www.able-consulting.com/ADO_Conn.htm
which had a bunch of examples, ain't google great? ;D
Enjoy!

First page Previous page 1 2 Next page Last page  View All
 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives