Home > Back-end >  Advice on how to use C builder to create a simple login window?
Advice on how to use C builder to create a simple login window?

Time:10-24

Connection is SQL SERVER2000 database, add the ADOConnection, ADOQuery, Datasource, DBgrid components after specific what to do? What is the code, which a great god can tell me grateful

CodePudding user response:

Such high scores, such a simple question, not science,

Simple said: get a window, the user can enter the user name and password, and a login button, click the login button, determine whether the input the user name and password, then try to connect to the database, open the specified user table, to input the user name of the relevant information, if there is no specified user, direct return failure, if the user is present, remove the password field, and the user to enter the password for match, the match is considered successful login, otherwise think failure, probably is such a process,

In practical application, of course, password field had better be to use hash encryption or (md5),

CodePudding user response:

The somebody else give points, small demon don't and others robbed,,,

CodePudding user response:

Landing window, there is no need for the Datasource, DBgrid this two controls

CodePudding user response:

You only need ADOConnection, ADOQuery these 2 control.. Other steps in accordance with the old demon method with respect to OK.

CodePudding user response:

Haven't people scattered points. The building Lord scatter, by the way, please. Thanks a lot.

CodePudding user response:

The
refer to the original poster u010434993 response:
connection is SQL SERVER2000 database, add the ADOConnection, ADOQuery, Datasource, DBgrid components after specific what to do? What code is, who is a great god can tell me grateful
what is your specific code? Can write to me

CodePudding user response:

refer to 6th floor u010434993 response:
refer to the original poster u010434993 response: connection is SQL SERVER2000 database, add the ADOConnection, ADOQuery, Datasource, DBgrid components after specific what to do? What code is, who is a great god can tell me, appreciate specific code how to write? Can you write to me


Read the advice or foundation or confused about

CodePudding user response:

In the select statement in comparison, some databases are not case sensitive, if you want to distinguish between the login name and password of case, it should pay attention to,

CodePudding user response:

refer to the eighth floor gzliudan response:
in the select statement in comparison, some databases are not case sensitive, if you want to distinguish between the login name and password of the case, it should pay attention to,
how to write specific code?

CodePudding user response:

refer to the eighth floor gzliudan response:
in the select statement in comparison, some databases are not case sensitive, if you want to distinguish between the login name and password of the case, it should pay attention to,

Don't be misled by!

SQL Server itself has don't need to build another account password system database table... Also by SQL Server to decide ~ judgment or not

CodePudding user response:

Judgment is a user name and password on the servo end (Server) rather than on the Client (Client)

CodePudding user response:

Client only provide input user name and password and then was introduced into the servo servo program comprised judgment... Results in response to client...

CodePudding user response:

Pick up points

Ha ha ha,

CodePudding user response:

Even now so honest lz, questions simple score is high

CodePudding user response:

 
Void __fastcall TForm1: : Button1Click (TObject * Sender)
{
ADOConnection1 - & gt; The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 4.0. Data Source=D: \ wu \ xe2work \ temp MDB. Persist Security Info=False ";
ADOConnection1 - & gt; LoginPrompt=false;
ADOQuery1 - & gt; The Connection=ADOConnection1;
ADOQuery1 - & gt; Close ();
ADOQuery1 - & gt; SQL - & gt; The Clear ();
//query whether have input user name
String SQL="select * from temp where the Login=";
SQL +="'" + EdName - & gt; The Text + "'";
ADOQuery1 - & gt; SQL - & gt; Add (SQL);
ADOQuery1 - & gt; The Open ();
If (ADOQuery1 - & gt; RecordCount)
{
If (ADOQuery1 - & gt; FieldByName (" pass ") - & gt; AsString==EdPass - & gt; The Text)
{
ShowMessage (" login successfully!" );
return;
}
The else
{
ShowMessage (" password error!" );
return;
}
}
The else
{
ShowMessage (" the user name does not exist!" );
return;
}
}


I want to take

CodePudding user response:

Above code can be used as a typical case of SQL injection to lecture,

CodePudding user response:

Demon elder brother, the typical SQL injection cases to teaching? Hey hey what meaning

CodePudding user response:

Don't think ~ should be lack of information protection!

CodePudding user response:

reference 15 floor wyp331993272 response:
C/C + + code? 12345678910111213141516171819202122232425262728293031 void __fastcall TForm1: : Button1Click (TObject * Sender) {ADOConnection1 - & gt; The ConnectionString="Provider=Microsoft. Jet. OLED...

The king's new clothes) approach is not workable ~
Oh ~ exclamation tutorial books perpetuated this misunderstanding how many ~
Literally next "select * from temp" not all of the user name and password away all revealed the light?
With the practice of real right should establish the required on the SQL Server end user members... Through the ADOConnection accompanying the Database of the Login window with SQL Server after enter the user name and password Login check attachment!
Key: the user name and password to log in check must be on the Server side... Must not be placed on the Client side. Remember that! Remember that!

CodePudding user response:

That the input user name controls to add an event not to go, with a user name to search the database, not with respect to OK

CodePudding user response:

reference wyp331993272 20 floor response:
in the input user name that controls add an event not to go, with a user name to search the database, not with respect to OK

Teaching examples and practical operation after all different ~

Dude you proposed is an example of tutorial books in general practice... In a closed environment also Ok... Such as the company's internal use enters sells saves the system... If the system is connected to the wan its side of SQL syntax easy to record and leak the key database... Thus database data was highly...

In the financial bank and even military database based on security protection... Usually in the database Server to establish in advance a lot of group SQL command blocks... Client program only to the Server specified command (the command refers to the number rather than the SQL commands) and the corresponding parameters after... The Server end will be according to the results of command back to client...

The practice in communication between client program files with the database Server no SQL trace... nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related