 |
Home:
Perl Programming Help:
Win32 Programming Help:
Re: [fashimpaur] dbi error:
Edit Log
|
|

wayko621
Novice
May 16, 2002, 9:05 AM
Views: 32503
|
Re: [fashimpaur] dbi error
|
|
|
the book didnt show that $sth = $dbh->prepare($sql); $rc = $sth->execute(); they showed $rc=$dbh->do($sql); $sth=$dbh->prepare("select * from table1"); $sth->execute(); i made the changes new code is use CGI; use CGI::Carp 'fatalsToBrowser'; #!/usr/bin/perl $first = $field{'first'}; $last = $field{'last'}; $address = $field{'address'}; $email = $field{'email'}; $phone = $field{'phone'}; $user = $field{'user'}; $pass = $field{'pass'}; use DBI; $dbh = DBI->connect("dbi:ODBC:'driver = Driver do Microsoft Access(*.mdb); dbq=test.mdb'")|| 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');}; print"$rc record(s) were added.<p>"; $sth = $dbh->prepare($sql); $rc = $sth->execute(); print"<table>\n"; print"<tr><th>ID</th><th>First</th><th>Last</th><th>Address</th><th>Email</th><th>Phone</th><th>User</th><th>Password</th>\n" ; while (@row = $sth->fetchrow_array) { print"<tr>"; foreach(@row) { print"<td>$_</td>"; } print"</tr>\n"; } print"</table>\n"; print"</body></html>"; $sth->finish; $dbh->disconnect; this is the new error Software error:Can't connect to database: [Microsoft][ODBC Driver Manager] Invalid string or buffer length (SQL-S1090)(DBD: db_login/SQLConnect err=-1) at C:\Inetpub\wwwroot\cgi-bin\database1.pl line 14. For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
(This post was edited by wayko621 on May 16, 2002, 9:16 AM)
|
|
Edit Log:
|
Post edited by wayko621
(Novice) on May 16, 2002, 9:11 AM
|
Post edited by wayko621
(Novice) on May 16, 2002, 9:16 AM
|
|
|  |