Home > database >  Pb SQL login window code (by) in the course of ASA
Pb SQL login window code (by) in the course of ASA

Time:10-01

String password, usename
If sle_1. Text="" or sle_2. Text=" "then
Messagebox (" error ", "user name or password cannot be empty!" , the exclamation! , ok!

The else
Select the user name, password
Into: usename, password
The from nbc1
Where nbc1. Username=: sle_1. Text;
If usename=sle_1. Text and password=sle_2. The text then
Open (w_main)
Close (w_login)
The else
Messagebox (" error ", "user name or password mistake, please input again", the exclamation! , ok!
End the if
End the if

Above for the login window code: under the pb comes with database ASA tests pass, but it cannot pass the SQL 2000 database, please expert help, thank you!

CodePudding user response:

Tracking once know!

CodePudding user response:

Whether in different expressions on format, though, like access and VFP is SQL query but sometimes said statement is different,

CodePudding user response:

Grammar should not be wrong, but is not achieve the effect

CodePudding user response:

I tried it once, if the user name and password different ones can get through it,

CodePudding user response:

I said, tracking the debugged!

So you write a bit problems

String s_pw, s_un
Int I
S_pw=trim (sle_1. Text)
S_un=trim (sle_2. Text)
//text value shall be taken to the variable to use!

Select count (*) into: (I)
The from nbc1
Where the username=: s_un and password=: s_pw;
//column names in Chinese, the trouble!
If I=1 then
//success
The else
//not successful
End the if



CodePudding user response:

If is me, will be roughly as follows:
 string as_emp_id, as_emp_pass 
Int I

As_emp_id=sle_1. Text
As_emp_pass=sle_2. Text

If len (as_emp_id)=0 or len (as_emp_pass)=0 then
Messagebox (" error ", "user name or password cannot be empty!" , the exclamation! , ok!
Return
End the if

Select 1 into: I
The from nbc1
Where the user name=: as_emp_id and
Password=: as_emp_pass;

If the sqlca. Sqlcode & lt;> 0 then
Messagebox (" error ", "user name or password mistake, please input again", the exclamation! , ok!
Return
End the if

Open (w_main)
Close (w_login)

Of course this is only for your writing, my practice is in call log objects

CodePudding user response:

Agree with the upstairs

CodePudding user response:

I also have a question outside, everybody's nickname are how to set??????? How do I not?? Where to set??? Thank you,,

CodePudding user response:

Add a breakpoint debug

CodePudding user response:

[Quote=refer to the original poster JTSZQZXZZH posts:]
String password, usename
If sle_1. Text="" or sle_2. Text=" "then
Messagebox (" error ", "user name or password cannot be empty!" , the exclamation! , ok!

The else
Select the user name, password
Into: usename, password
The from nbc1
Where nbc1. Username=: sle_1. Text;
If usename=sle_1. Text and password=sle_2. The text then
Open (w_main)
Close (w_login)
The else
Messagebox (" error ", "user name or password mistake, please input again", the exclamation! , ok!
End the if
============================================================
"Messagebox (" error", "user name or password cannot be empty!" , the exclamation! , ok! "
Behind + 1 sentence: return
"If usename=sle_1. Text and password=sle_2. The text then"
The front +
If the sqlca. Sqlcode<> 0 then
Messagebox (" ", "could not find the data in the database!" )
Return
End the if
Other should pay attention to use the trim removes white Spaces at the both side, is no problem


Back to the eighth floor, said in my community - & gt; Personal information -> community said ok ~



CodePudding user response:

The
references to the tenth floor SKY_4K_PPM response:
back to the eighth floor, said in my community - & gt; Personal information -> community said ok ~

thank you!! Ha ha, I was too stupid, dull to,,,

CodePudding user response:

Ha ha, myopia

CodePudding user response:

Bad habits, the error of messagebox must Return, otherwise the program or go down, you write a messagebox is meaningless

CodePudding user response:

Select the user name, password
Into: usename, password
The from nbc1
Where nbc1. Username=: sle_1. Text;
You all know the user name=sle_1. Text;
Why is "select user name and password"?
Database optimization certainly fail!

CodePudding user response:

Basic skills is not strong!!!

CodePudding user response:

If isnull (usename, ")=sle_1. Text and isnull (password, ")=sle_2. Text then

CodePudding user response:

I run for a moment, why do you still won't do ah, please comment, thank you!
String password, usename
Usename=trim (sle_uer. Text)
Password=trim (sle_psw. Text)
If sle_uer. Text="" or sle_psw. Text=" "then
Messagebox (" error ", "user name or password cannot be empty!" , the exclamation! , ok!

The else
The select mname, MPSD
Into: usename, password
The from manager
Where manager. Mname=: sle_uer. Text and manager. The SPSW=sle_psw;
If the sqlca. Sqlcode & lt;> 0 then
Messagebox (" ", "could not find the data in the database!" )
Return
End the if
If usename=sle_uer. Text and password=sle_psw. The text then
Open (w_chpassword)
Close (w_login)
The else
Messagebox (" error ", "user name or password mistake, please input again", the exclamation! , ok!
Return
End the if

The error syntax error

CodePudding user response:

Nbc1. User name is not legalnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related