Hi,
I should have missed something in my code. And also I should have said I'm
not a Perl programmer at all. But it is true, it's not so difficult to make
only a little change in the Perl code as I did, and we don't have to be Perl
gurus, at all!
So try again with the simpler code I attach. It's a single few-lines module
which shoud be very easy to understand; then try to make it work within
regsys.cgi. At the end you will only change the fields/table definitions.
Unfortunately I did this work more than one year ago, so I don't remember
which problems were addressed, but if you want you can contact me again, and
I will try to help. Ok?
Regards,
gsa
Module 1 - writing to a database (Perl, commented is an alternative version)
use OLE; # use Win32::OLE if using the Std Distribution
$Conn = CreateObject OLE "ADODB.Connection";
$Conn->Open("edromeSQL");
$Conn->Execute("INSERT INTO tblDomains (id, domain) VALUES (5,
'JohnDoe.com')");
#$RS = $Conn->Execute("tblDomains");
#if(!$RS) {
$Errors = $Conn->Errors();
print "Errors:\n";
foreach $error (keys %$Errors) {
print $error->{Description}, "\n";
}
# die;
#}
# my $Fields = ['domain'];
# my $Values = ['JoeDoe.net'];
# $RS->AddNew($Fields, $Values); # adds a record
# $RS->AddNew;
# $RS->Fields('domain') == "aaaaaaaaaaaa";
# $RS->Update;
# print "aaaaaaaaaaaaaaaa";
#$RS->Close;
$Conn->Close;
This module, saved in the CGI directory HAS to work with litte or no
changes.
Module 2 - reading from the database (Perl)
use OLE; # use Win32::OLE if using the Std Distribution
$Conn = CreateObject OLE "ADODB.Connection";
$Conn->Open("aielli_org");
$RS = $Conn->Execute("SELECT * FROM tblDomains");
if(!$RS) {
$Errors = $Conn->Errors();
print "Errors:\n";
foreach $error (keys %$Errors) {
print $error->{Description}, "\n";
}
die;
}
while ( !$RS->EOF ) {
my($Dominio, $Timestamp) = (
$RS->Fields('domain')->value,
$RS->Fields('timestamp')->value );
print $Dominio, " : ", $Timestamp, "\n";
$RS->MoveNext;
}
$RS->Close;
$Conn->Close;
Pay attention: check for table, fields and DSN names!!!! And also, check
carefully the SQL syntax, to be compliant with your database (in previous
examples I used an Access database).
----- Original Message -----
From: Scott McKee
To: [EMAIL PROTECTED]
Sent: Saturday, August 18, 2001 1:11 AM
Subject: Payment Processing - NT Com Component follow up
As a W2K user of OpenSRS, I have been looking for a way to incorporate
online payments using Beanstream for quite some time. I was very interested
in Giuseppe Simone Aielli's suggestion to use a database write in the NT Com
Component thread on July 31. However, being Perl dense, I have not been able
to make it work. I 've ceated the db & DSN and inserted the code into
reg_system.cgi. I had to insert a 'my' in front of the first call to $Conn
to declare the variable but ohterwise, the code continues to work, it just
doesn't write to the database. If I do a db write using ASP, everything
works fine so I don't suspect rights or DSN.
If anyone can shed some light on this problem, has another way of pulling
data from the cgi script or has another W2K solution (Com Component?) I
would be greatful for any feedback. I do all of my work in ASP and I am
hesitant to learn Perl just to solve this problem.
Thanks
Scott McKee
www.distinctdomain.com