Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with tk and select quary when I convert program to .exe file

Status
Not open for further replies.

mohsenalizadeh

Programmer
Mar 17, 2010
5
0
0
IR
hello
I writr this program to show answer of quary to the users and , then
users can update information.
when Run program with IDE ( for example : Komodo ), it works
correctly .but when I convert program to .exe with cava packager ,
its not working. ( select quary not working).

when I change the $dbh->fetchrow_array(); with WHILE loop :

While(our @rec = $dbh->fetchrow_array()){
our $name = $rec[1];
our $adminname = $rec[2];
our $myphone1 = $rec[3];
our $myphone2 = $rec[4];
our $myaddress = $rec[5];
our $mypercent = $rec[6];
}


and convert program to .exe , WHILE LOOP convert to Infinite loops .
-----------------------------------------------------------
#!C:/strawberry/perl/bin/perl.exe

use Tk;
use DBI;

$mw = MainWindow->new(-background=>"gray");
$mw->title("$header");
$mw->maxsize(800,315);
$mw->minsize(800,315);

$cn = DBI->connect("DBI:mysql:telephontaxi","root","root",
{mysql_enable_utf8 => 1});
$dbh = $cn->prepare("select * from telephonetaxiinformation");
$dbh->execute();

our @rec = $dbh->fetchrow_array();
our $name = $rec[1];
our $adminname = $rec[2];
our $myphone1 = $rec[3];
our $myphone2 = $rec[4];
our $myaddress = $rec[5];
our $mypercent = $rec[6];

$dbh->finish;
$cn->disconnect;

$mw->Label(-text=>"$header",-font => "Titr 23",-anchor=>'center',-
width=>34,-background=>"gray")->place(-x => 0,-y=>0);
$fram = $mw->Frame(-relief => 'groove',-borderwidth => 0,-width=>780,-
height=>240)->place(-x => 10,-y=>64);

$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief
=>'groove',-textvariable => \$name)->place(-x =>410,-y=>15);

$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief
=>'groove',-textvariable => \$adminname)->place(-x =>410,-y=>55);

$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief
=>'groove',-width=>4,-textvariable => \$mypercent)->place(-x =>170,-
y=>30);

$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief
=>'groove',-textvariable => \$myphone1)->place(-x =>410,-y=>95);

$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief
=>'groove',-textvariable => \$myphone2)->place(-x =>50,-y=>95);

$fram->Entry(-font => "Tahoma 13 normal",-width=>60,-justify
=>'right',-relief =>'groove',-textvariable => \$myaddress)->place(-x
=>50,-y=>145);

$fram->Button(-text=>"Save",-font => "Tahoma 13 normal",-command =>
[ \&saveinformation ])->place(-x =>370,-y=>190);
$fram->Button(-text=>"Exit",-font => "Tahoma 13 normal",-command =>
[$mw => 'destroy'])->place(-x =>320,-y=>190);

MainLoop;


sub saveinformation{
$cn = DBI->connect("DBI:mysql:telephontaxi","root","root",
{mysql_enable_utf8 => 1});
$dbh = $cn->prepare("update telephonetaxiinformation set
azansname='$name',azansadmin='$adminname',phone1='$myphone1',

phone2='$myphone2',azansaddress='$myaddress',azanspercent='$mypercent'
where azansid='1'");
$dbh->execute();
$cn->disconnect;
$dbh->finish;
$cn1 = DBI->connect("DBI:mysql:telephontaxi","root","root",
{mysql_enable_utf8 => 1});
$dbh1 = $cn1->prepare("select azansid from
telephonetaxiinformation where azansname='$name'");
$dbh1->execute();
my @rec = $dbh1->fetchrow_array();
print $rec[0];
if($rec[0] ne ""){
$message = "save correctly...";

$fram->Label(-text=>"$message",-font => "homa 15")->place(-
x =>600,-y=>190);
$mw->messageBox (
-default => 'Ok',
-title => "$message",
-message => "$message",
-type => 'Ok',
);
}
$dbh1->finish;
$cn1->disconnect;

}
 
When it is inifinitely looping, is $dbh->fetchrow_array() returning a record each time? Is it the same record over and over again, or does it return the usual records, and then blank ones at the end, or something else? Try adding a print statement to the loop to figure this out.

I see you've also posted in the Cava support mailing list, which is good.

Annihilannic.
 
Hi
NOTE :
Whwn program Running with IDE , It is work Correctly , But when program convert to .exe file with CAVA PACKAGER ,only SELECT quary not working , But INSERT AND UPDATE working correctly.
thankyou.
 
Hi
I noticed a new point , before convert script to .exe ,if run program withour IDE ( Run with comman line ), My SELECT quary does not work.But UPDATE AND INSERT Commands to work properly.
Why ?
please help me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top