Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2006, 12:32 AM
Registered User
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hanumanth.sr
Default validating Login Forms



  Hai,
   I am doing one Project(WindowsApplication using VB.NET)

  I want to check the valid name with valid password which is stored in SQL Server Database.

Plz send me a sample coding for this one..
 
Old April 19th, 2006, 02:34 PM
Authorized User
 
Join Date: Apr 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to al-hijjawi
Default

no problem here
see the following code:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim con As New SqlConnection
        Dim cmd As New SqlCommand
        Dim No As String
        Dim p As SqlParameter
        con.ConnectionString = "user id=UserName;data source=(local);persist security info=True;initial catalog=DatabaseName;password=PassWord"
        cmd.Connection = con
        cmd.CommandType = CommandType.Text
        p = cmd.Parameters.Add("@user", Convert.ToInt16(0))
        p = cmd.Parameters.Add("@pass", 1)
        cmd.Parameters("@user").Value = txtuser.Text
        cmd.Parameters("@pass").Value = txtpassword.Text
        cmd.CommandText = "SELECT AdminstratorNo, UserName, PassWord FROM Adminstrator WHERE (UserName =@user and PassWord=@pass)"
        cmd.Connection.Open()
        No = cmd.ExecuteScalar()
        If (No = "") Then
            message.Text = "Error"
        Else
                        'Go to the next form
        End If
        cmd.Connection.Close()
    
    End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
forms authentication with two login pages janetb ASP.NET 2.0 Basics 2 March 25th, 2008 08:09 AM
Validating Forms Problems encohen Access 2 July 3rd, 2006 07:30 AM
login failed for user nt authority\anonymous login rj1406 Classic ASP Databases 1 October 24th, 2004 09:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.