Filter

sundar k replied to Timothy Purvis at 04-Jul-08 04:21

If you want to achieve better performance, I would suggest you to move the below function call to your form_load event where you open the recordset for all the staffs:

Call ConnectRS(CN, RS, "SELECT name,password FROM staff")

And then  your CheckNameAndPassword code can be changed as,

Public Sub CheckNameAndPassword()

RS.Filter = "name ='" & txtName.Text & "' and password ='" & txtPwd.Text & "'"

If RS.RecordCount = 0 Then
        MsgBox "Invalid Name & Password combination entered", vbCritical
        txtName.Text = ""
 txtPwd.Text = ""
        CN.Close
        Call ConnectDB(CN, App.Path & "\users.mdb")
        Exit Sub
End If

'reset the filter every time so that you will get all the records from staff table
RS.Filter = ""

'RS.Close - Close the recordset whenever your form closes
End Sub


Here, since we are  using Filter property of recordset,  you dont have to execute the query again and again for each and every name/password change.



Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  Password Validation - Timothy Purvis  03-Jul-08 09:18 9:18:00 PM
      Try this - sri sri  03-Jul-08 11:25 11:25:41 PM
      Password Validation - Swapnil Salunke  04-Jul-08 12:15 12:15:54 AM
          parssword vali - Umapathy Kaliaperumal  04-Jul-08 12:26 12:26:49 AM
              Its not advisable to use both validation at once - Arjun Priyananth  04-Jul-08 12:52 12:52:19 AM
      Filter - sundar k  04-Jul-08 04:21 4:21:25 AM
      Password Validation - Sanjay Verma  04-Jul-08 05:21 5:21:59 AM
View Posts

promotion
Silverlight    WPF    WCF    WWF    LINQ   
JavaScript    AJAX    ASP.NET    XAML   
C#    VB.NET    VB 6.0    GDI+    IIS    XML   
.NET Generics    Anonymous Methods    Delegate   
Visual Studio .NET    Expression Blend    Virus   
Windows Vista    Windows XP    Windows Update   
Windows 2003 Server    Windows 2008 Server   
SQL Server    Microsoft Excel    Microsoft Word   
SharePoint    BizTalk    Virtual Earth   
.NET Compact Framework    Web Service   


"Everything" RSS / ATOM Feed Parser
How to send and receive messages through message queuing in .Net
How to Read text file as database
SQL Server 2005 Paging Performance Tip
Display code of web page.
Fully Scalable Excel File Importer class for .net using Microsoft Jet driver
Generic Chart Color Manager class that can be used for any charts
Helper class to style the infragistics wingrid
Using Reflection to detemine as Assembly Info in and out.
Helper class to play with Window (Owners and position)
Resolving displayname from the culture using the XmlLanguage and LanguageSpecificStringDictionary class