国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

asp.net用戶注冊(cè)時(shí)的驗(yàn)證

2024-07-10 12:57:25
字體:
供稿:網(wǎng)友

////驗(yàn)證用戶名是否與注冊(cè)數(shù)據(jù)庫中的重名!!!
private sub check_click(byval sender as system.object, byval e as system.eventargs) handles check.click
dim myconnection as oledbconnection
dim mycommand as oledbcommand
dim dbname as string
dbname = server.mappath("db1.mdb")
myconnection = new oledbconnection("provider=microsoft.jet.oledb.4.0;data source=c:/documents and settings/administrator/my documents/visual studio projects/webapplication1 (2)/database/db1.mdb")數(shù)據(jù)庫所在的目錄

if userid.text = "" then
label5.text = "error!!you must complete it"
else

dim checklogin as string
checklogin = "select * from users "

dim cmd as new oledbcommand(checklogin, myconnection)
dim reader as oledbdatareader

try
myconnection.open()
reader = cmd.executereader()
reader.read()

if userid.text = reader("userid") then
label5.text = "the userid had been used"
else
label5.text = "this userid can use"
end if
catch err as exception
trace.write(err.message)
label5.text = "checked error"
finally
if (not myconnection is nothing) then
myconnection.close()
end if

end try
end if
end sub



////用戶注冊(cè)
private sub regist_click(byval sender as system.object, byval e as system.eventargs) handles regist.click
dim myconnection as oledbconnection
dim mycommand as oledbcommand
dim dbname as string
dbname = server.mappath("db1.mdb")
myconnection = new oledbconnection("provider=microsoft.jet.oledb.4.0;data source=c:/documents and settings/administrator/my documents/visual studio projects/webapplication1 (2)/database/db1.mdb")
dim strinsert as string
strinsert = "insert into users("
strinsert &= "u_id,u_password)"
strinsert &= "values('"
strinsert &= userid.text & "','"
strinsert &= password.text & "')"
dim cmd as new oledbcommand(strinsert, myconnection)
dim added as integer
try
myconnection.open()
added = cmd.executenonquery
if added > 0 then
label5.text = "your information is added"
response.redirect("home.aspx")

end if
catch err as exception
trace.write(err.message)
label5.text = "added error"
finally
if (not myconnection is nothing) then
myconnection.close()
end if
end try

end sub


/////



////

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 固镇县| 灵川县| 合肥市| 青川县| 迭部县| 光泽县| 开平市| 九龙城区| 兴安盟| 乐平市| 深水埗区| 长春市| 大兴区| 隆昌县| 盐边县| 滨州市| 蚌埠市| 于田县| 奉化市| 沿河| 泗阳县| 博湖县| 临泽县| 陵水| 江西省| 江安县| 于田县| 濮阳市| 平凉市| 龙川县| 大英县| 天水市| 来安县| 清涧县| 温州市| 沧源| 通化县| 潜江市| 宣恩县| 隆化县| 黄梅县|