Click here to Skip to main content
12,078,070 members (48,357 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
i m making electronic paper system
how can i compare textbox fields with SQL database values on my login button?
Posted 5-Jan-13 1:28am
Comments
GeekforChrist 5-Jan-13 8:39am
   
Do you have any knowledge of SQL or are you looking for complete code?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

How can i compare textbox fields with SQL database values on my login button?
Steps:
1. On login button press, raise the click event. Write your comparison code here in this click handler.
2. Now, using ADO.NET, connect to database. Form a query for comparison of the value in DB
3. Run the query and get back the result
4. Take action based on the result returned.

Few references that would help:
MSDN: Accessing Data with ADO.NET[^]
Using ADO.NET for beginners[^]
Simple ADO.NET Database Read, Insert, Update and Delete using C#.[^]
  Permalink  
Comments
Espen Harlinn 6-Jan-13 9:25am
   
Nice links :-D
Sandeep Mewara 6-Jan-13 10:11am
   
Thanks Espen.
Mika Wendelius 6-Jan-13 10:57am
   
Good examples!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

SQL database values on my login button
Please don't do this yourself, use ASP.NET Authentication[^].

Security is a thorny issue which requires an in depth understanding of a wide range of technologies. ASP.Net provides authentication and authorization out of the box, so there is no need to implement this yourself.

Best regards
Espen Harlinn
  Permalink  
Comments
Mika Wendelius 6-Jan-13 10:58am
   
Good point!
Espen Harlinn 6-Jan-13 10:59am
   
Thank you, Mika :-D
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

con.con_open()
 
        Dim cmdlogin As New SqlCommand(("SELECT * FROM users WHERE user_name='" & _
                                            txtuname.Text & "' and password='" & _
                                            txtpassword.Text & "'"), con.con)
        Dim dalogin As New SqlDataAdapter
        Dim dslogin As New Data.DataSet
        dalogin.SelectCommand = cmdlogin
        cmdlogin.ExecuteNonQuery()
        dslogin.Clear()
        dalogin.Fill(dslogin, "users")
 

        If dslogin.Tables(0).Rows.Count > 0 Then
 
        Else
            
        End If
 
'--------------------or

        if txtusername.text=dslogin.Tables(0).Rows(0).Item(0).ToString then
 
        else
 
        end if
 
'--------------------

        con.con_close(
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160212.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100