Home > database >  After pb generated executable file
After pb generated executable file

Time:09-24

String x1, x2, x3, x4
The x3=trim (sle_1. Text)
X4=trim (sle_2. Text)
Select *
Into: x1, x2
The from yh
Where user1=: x3 and pass=: x4;
If the sqlca. Sqlcode=0 then
Open (w2)
Close (w1)
The else
Messagebox (" error ", "user name or password error")
End the if
(login window code, in the event of an open database connection code, that no problem)
Before didn't generated exe, in PB, no problem, but the generated executable, the question becomes,
Pb generated executable file, after the login window can be opened, can also be connected to the database, when you click the login button, if the user name and password are not preordained on the part of the data in the table, it will prompt wrong, but after input the correct user name and password, click the login button, the program was dead, no response, ask what is this, really don't understand,

CodePudding user response:

This code is ok, other place to disconnect from the database?

CodePudding user response:

Add some test statements inside under debugging, how can you be sure the error is not in the open (w_2) happen?
In addition the author select * is not a good habit, clearly write the field name in the code is better,

CodePudding user response:

Not code problem, the problem of PB itself?

CodePudding user response:

 
Select *
Into: x1, x2
The from yh
Where user1=: x3 and pass=: x4;
This sentence has a problem, yh how assignment, if the number of columns more than 2 columns can use the following statement to judge the existence of a user name password and

Int li_count
Select count (*)
: li_count
The from yh
Where user1=: x3 and pass=: x4;
If li_count & gt; 1 then
//the user password right
The else
//the user password is not correct
End the if



  • Related