Home > database >  Using pb read the value of the database
Using pb read the value of the database

Time:09-19

My database in the data type of varchar
But take less than data in the database,,,
This program is to read the data in the database value:
String username
String keyword
String s_KW, s_NM
String user
The string key
User=Trim (sle_1. Text)
Key=Trim (sle_2. Text)
Declare student cursor for the select KW from PASS where NM=: s_NM;
S_NM=trim (sle_1. Text)
The open student;
The fetch student into: s_KW;
The username=string (s_NM)
Keyword=string (s_KW)
If the user=username and key=keyword then
Messagebox (" true ", "login successfully!" )
Close (the parent)
The else
Messagebox (" false ", "login failed, please input again!" )
Sle_1. Text=string (sle_1. Text)
Sle_2. Text='
End the if
The close student;

CodePudding user response:

Connect to the database?

Step once, see a problem somewhere, if you do not take data, have a look at the sqlca. Sqlerrtext return is anything wrong, according to the error to modify the program

CodePudding user response:

reference 1st floor lzp_lrp response:
connect to the database?

Step once, see a problem somewhere, if you do not take data, have a look at the sqlca. Sqlerrtext return is anything wrong, to modify the program according to the error

+ 1

CodePudding user response:

After using your cursor, to shut down, see you have a close (the parent), and not to close the cursor,
Change the following:

 
String username
String keyword
String s_KW, s_NM
String user
The string key
User=Trim (sle_1. Text)
Key=Trim (sle_2. Text)
Declare student cursor for the select KW from PASS where NM=: s_NM;

S_NM=trim (sle_1. Text)

The open student;
The fetch student into: s_KW;
The close student;

If the sqlca. Sqlcode & lt;> 0 then
Messagebox (' hint! ', 'open cursor failed! ~ n '+ sqlca. Sqlerrtext)
Return
End the if

The username=string (s_NM)
Keyword=string (s_KW)
If the user=username and key=keyword then
Messagebox (" true ", "login successfully!" )
Close (the parent)
The else
Sle_1. Text=string (sle_1. Text)
Sle_2. Text='
Messagebox (" false ", "login failed, please input again!" )
Return
End the if

CodePudding user response:

The close student;
In a
If the sqlca. Sqlcode & lt;> 0 then
Messagebox (' hint! ', 'open cursor failed! ~ n '+ sqlca. Sqlerrtext)
Return
End the if
The back!

CodePudding user response:

The return of the top row
  • Related