Click here to Skip to main content
15,896,526 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello friends,

my project is based on asp.net c#, Sqlserver 2005.

I have two textboxes on my webpage
1)Enter DeptName - TxtDeptName
2)Enter Password - TxtPassword.

Already the deptName and Password are stored in sqlserver database table(DEPTInfo). as
DeptName - IT
Password - itpwd.


so on my webpage, Deptname is autocomplete from (DeptInfo) table. now just i want to detect the password according to deptname.

The passord Textbox must match according to deptname Textbox.
these deptname and password are already stored in database.

Please help me, how to do this.

Thanks.
Posted
Comments
Prasad Khandekar 23-Apr-13 4:05am    
Write a onChange handler for password textbox and make a AJAX call to check whether password for the department matches the one stored in database.
Software Engineer 892 23-Apr-13 4:09am    
please can you show me how to do that, thanks.
José Amílcar Casimiro 23-Apr-13 5:23am    
It does not seem a good idea to put the Password field with autocomplete option. After all we are talking about authentication and subsequent authorization.
Rockstar_ 23-Apr-13 6:03am    
Onblur event of txtpwd textbox compare the textboxes....

1 solution

Do something like this. Im using oracle database here.

Imports System.Net
Imports Oracle.DataAccess.Client
Imports System.Configuration
Imports System.Data
Partial Class _Default
    Inherits System.Web.UI.Page
    Public conSMART As New Oracle.DataAccess.Client.OracleConnection

    Protected Sub TextBox1_TextChanged(sender As Object, e As System.EventArgs) Handles TextBox1.TextChanged
       
        conSMART.ConnectionString = "Data Source=LIVE_SMART;User ID=smart_dev;Password=yourpassword"
        conSMART.Open()

        Dim usrname As String
        usrname = TextBox1.Text.ToString


        Dim sqlclause As String
        Dim da As OracleDataAdapter
        sqlclause = "select password as pwd from yourtable where username ='" + usrname + "'"
        da = New OracleDataAdapter(sqlclause, conSMART)
        Dim ds As New DataSet
        da.Fill(ds)
        TextBox2.Text = CType(ds.Tables(0).Rows(0)("pwd"), String)

    End Sub
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900