sub push_botton3{
my $mw = new MainWindow; # Main Window
my $frm_name = $mw -> Frame();
my $lab1 = $frm_name -> Label(-text=>"Id Number",-width=>10);
my $lab2 = $frm_name -> Label(-text=>"Room Number:");
my $lab3 = $frm_name -> Label(-text=>"Money:");
my $ent1 = $frm_name -> Entry(); ###输入文本框
my $ent2 = $frm_name -> Entry(); ###输入文本框
my $ent3 = $frm_name -> Entry(); ###输入文本框

my $but = $mw -> Button(-text=>"ok", -command =>\&sub_fun3);
my $textarea = $mw -> Frame(); #Creating Another Frame
my $txt = $textarea -> Text(-width=>40, -height=>10);
my $srl_y = $textarea -> Scrollbar(-orient=>'v',-command=>[yview => $txt]);
my $srl_x = $textarea -> Scrollbar(-orient=>'h',-command=>[xview => $txt]);
$txt -> configure(-yscrollcommand=>['set', $srl_y],
-xscrollcommand=>['set',$srl_x]);
$lab1 -> grid(-row=>1,-column=>1);
$lab2 -> grid(-row=>2,-column=>1);
$lab3 -> grid(-row=>3,-column=>1);
$ent1 -> grid(-row=>1,-column=>2);
$ent2 -> grid(-row=>2,-column=>2);
$ent3 -> grid(-row=>3,-column=>2);
$frm_name -> grid(-row=>1,-column=>1,-columnspan=>2);
$but -> grid(-row=>4,-column=>1,-columnspan=>2);
$txt -> grid(-row=>1,-column=>1,-ipadx=>160,-ipady=>100);
$srl_y -> grid(-row=>1,-column=>2,-sticky=>"ns");
$srl_x -> grid(-row=>2,-column=>1,-sticky=>"ew");
$textarea -> grid(-row=>5,-column=>1,-columnspan=>20);
MainLoop;
sub sub_fun3 {
my $dbName = 'june';
my $dbUser = 'test';
my $dbUserPass = 'test';
my $dbh = DBI->connect("dbi:Oracle:$dbName", $dbUser, $dbUserPass) or die "can't connect to database ";
my $name1 = $ent1 -> get();
my $name2 = $ent2 -> get();
my $name3 = $ent3 -> get();
$txt -> insert('end',"$name1 $name2 $name3");
$dbh->do("insert into register_info values ('$name1','$name2','$name3')") or die($DBI::errstr);
$dbh->disconnect();
}}