One of the more popular custom repositories uses SQL as its database, and this is also pretty easy, as SQL has built-in functions for effective searching, even if the database contains a huge number of users. To interact with SQL, Windows offers the built-in ADODB object. All you have to do is initialize it, and create an SQL Select
query to poll the user's name and password from SQL.
The following screenshot shows the sample code:
The code defines the name of the SQL server, DB name, and the SQL user which has access to the user's list table. It then creates an SQL query to select the table rows that match the user's username and password, and executes the query. After this, if the resulting collection is not empty, it means that at least one record matches both the username and password, and that's what we want. Otherwise, there is no match and the authentication fails.
The preceding example is far from programming best practices as it is not very secure, due...