问题描述
你好朋友,
我的项目基于asp.net c#,Sqlserver 2005.
我的网页上有两个文本框
1)输入DeptName - TxtDeptName
2)输入密码 - TxtPassword。
deptName和Password已经存储在sqlserver数据库表(DEPTInfo)中。 as
DeptName - IT
密码 - itpwd。
等等我的网页,Deptname是从(DeptInfo)表自动完成的。现在我想根据deptname检测密码。
密码文本框必须根据deptname Textbox匹配。
这些deptname和密码已存储在数据库中。
请帮帮我,怎么做。
谢谢。
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.
推荐答案
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
这篇关于如何使用asp.net中的文本框检测基于部门的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!