First: Database Design: (Database for Access) Member Information Meter User_Info
Field
Description
Type (length)
Note
Id
Member logo
auto numbering
Self Growth
User_name
username
text
User_password
password
text
Question
Password prompt problem
text
Answer
answer
text
Name
call
text
SEX
gender
text
Birthday
Birthday
Date type
Region
area
text
CITY
city
text
Address
address
text
Phone
phone
text
text
CIERTIFIED
Yes No certification
text
Ctype
Type of membership
text
User_grade
Member level text
2: Code Implementation: <% DIM CONN, ConnString, dbfiledbfile = server.mappath ("/ database / db.mdb") set conn = server.createObject ("AdoDb.Connection" 'Connstring = "proviker = Microsoft.jet. OLEDB.4.01; Data Source = "& dbfileconnstring =" Driver = {Microsoft Access Driver (* .mdb)}; DBQ = "& dbfileConn.open connstring 'define user class class user_Info dim ID, User_Name, user_Password, Question, Answer, name, Sex, Birthday, Region, City, Address dim Phone, Email, Ciertified, CType, User_Grade 'class initialization Private Sub Class_Initialize ID = 0 User_Name = "" user_password = "" Question = "" Answer = "" name = "" SEX = "" birthday = "1910-01-01" region = "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Sub 'loading user information PUBLIC SUB LOAD (Byval username) DIM RS, SQL SQL = "SELECT * from user_info where user_name ='" & username "set = conn.execute (sql) if not (rs.bof and rs.eof) THEN ID = rs ("ID") user_name = rs ("user_name") User_password = rs ("user_password") Question = rs ("QU Estion ") Answer = RS (" Answer ") Name = RS (" Name ") SEX = RS (" SEX ") Birthday = RS (" Birthday ") Region = rs (" region ") City = rs (" city " Address = RS ("Address") Phone = rs ("Phone") Email = RS ("Email") cIrtified = rs ("ciertified") ctype =
RS ("ctype") user_grade = rs ("user_grade") end if rs.close set = nothing end sub 'detects the user's existing database' return value: true existence, false does not exist; public function iexist () DIM RS , SQL, FLAG SQL = "SELECT * from user_info where user_name = '" & user_name "" SET RS = conn.execute (sql) if not (rs.bof and r.eof) THEN flag = true else flag = false End if rs.close set = Nothing meansxist = flag end function 'When logging in, it is determined whether the user password is correct' Return value: True is correct, false Returns Public Function ISPASsed () DIM RS, SQL, FLAG IF User_Name <> "" "" "" "" "" "" "" " <> "" "THEN SQL =" SELECT * from user_info where user_name = '"& user_name"' and user_password = '"& password &" "set = conn.execute (sql) if not (rs.bof and rs .eof) then Flag = True else Flag = False end if rs.close set rs = Nothing else Flag = False end if IsPassed = Flag End Function 'Add new user Public Function Add () dim strSQL if IsExist () = True then Add = False exit function end if if User_name = "" or qustion = "" OR Answer = " then Add = False exit function end if strSQL = "Insert into User_Info (User_Name, User_Password, Question, Answer, Name, Sex, Birthday, Region, City, Address, Phone, Email, Ciertified, CType, User_Grade)" strSQL = strSQL & "VALUES ('" & user_name ",'" strsql = strsql & user_password & "," strsql = strsql & "'" & quhip "'," strsql =
Strsql & "'" & Answer & "'," STRSQL = strsql & "'" & name "", "strsql = strsql &"' "& sex &", "strsql = strsql &" # "& birthday & "#," Strsql = strsql & "'" & region & "," strsql = strsql & "" & city & "," strsql = strsql & "" "strsql = strsql &" "'" & Phone & "," strsql = strsql & "'" & email "," strsql = strsql & "" & ciertified & "," strsql = strsql & "" & ctype & " , "Strsql = strsql &" '"& user_grade &") "' response.write strsql conn.execute (strsql) add = true end function 'user modified information public substate () DIM strsql if id = 0 THEN EXIT SUB End if strsql = "Update User_info set user_password = '" & user_password "" strsql = strsql & ", quothes ='" & quhip & "" strsql = strsql & ", answer = '" & answer & "'" Strsql = strsql & ", birthday = #" & birthday & "#" strsql = strsql & ", sex = '" & sex & "" strsql = strsql & ", region ='" & region & "" strsql = Strsql & ", City = '" & city & "'" strsql =
Strsql & ", Address = '" strsql = strsql & ", phone ='" & phone & "" strsql = strsql & ", email = '" & email & "strsql = strsql &" ", Ciertified = '" & ciertified & "" "strsql = strsql &", ctype =' "& ctype" '"strsql = strsql &", user_grade =' "& user_grade &" "strsql = strsql &" Where ID = "& ID conn.Execute (strSQL) End Sub 'delete user Public Sub delete () dim strSQL if IsExist = True then strSQL =" delete from user_Info where User_Name =' "& User_Name &" ' "conn.execute (strSQL ID = 0 end if End sub 'class termination private sub class_terminate End Subend Class%> Not very perfect, please give me guidance. Author Blog:
http://blog.9cbs.net/tigerlgf/