Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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 0:28am
Comments
GeekforChrist at 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 at 6-Jan-13 9:25am
   
Nice links :-D
Sandeep Mewara at 6-Jan-13 10:11am
   
Thanks Espen.
Mika Wendelius at 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 at 6-Jan-13 10:58am
   
Good point!
Espen Harlinn at 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
0 OriginalGriff 328
1 Sergey Alexandrovich Kryukov 295
2 Gihan Liyanage 292
3 ClimerChinna 222
4 Abhinav S 187
0 Sergey Alexandrovich Kryukov 8,213
1 OriginalGriff 7,089
2 CPallini 2,598
3 Richard MacCutchan 1,925
4 Abhinav S 1,778


Advertise | Privacy | Mobile
Web01 | 2.8.140826.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2014
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