<%
'//查詢方法
'//----------------------------(1)-------------------------------
set rsworkuserinfo = server.createobject("adodb.recordset")
strsql = "select usersid, loginname, username, password"
strsql = strsql & " from users"
strsql = strsql & " where usersid=" & sqlstr(tuserid)
if rsworkuserinfo.state = 1 then
rsworkuserinfo.close
end if
rsworkuserinfo.open strsql,conn,1,1
if not rsworkuserinfo.eof then
loginname = rsworkuserinfo("loginname")
username = rsworkuserinfo("username")
password = rsworkuserinfo("password")
end if
rsworkuserinfo.close
set rsworkuserinfo = nothing
'//----------------------------(2)-------------------------------
strsql = "select usersid, loginname, username, password"
strsql = strsql & " from users"
strsql = strsql & " where usersid=" & sqlstr(tuserid)
set rsfind = conn.execute(strsql)
if not rsfind.eof then
loginname = rsfind("loginname")
username = rsfind("username")
password = rsfind("password")
end if
rsfind.close
set rsfind = nothing
'//修改方法
'//----------------------------(1)-------------------------------
set rsworkuserinfo = server.createobject("adodb.recordset")
strsql = "select usersid, loginname, username, password"
strsql = strsql & " from users"
strsql = strsql & " where usersid=" & sqlstr(tuserid)
if rsworkuserinfo.state = 1 then
rsworkuserinfo.close
end if
rsworkuserinfo.open strsql,conn,1,3
if not rsworkuserinfo.eof then
rsworkuserinfo("loginname") = loginname
rsworkuserinfo("username") = username
rsworkuserinfo("password") = md5(password)
rsworkuserinfo.update
update = true
else
update = false
end if
rsworkuserinfo.close
set rsworkuserinfo = nothing
'//----------------------------(2)-------------------------------
strsql = "update users"
strsql = strsql & " set loginname=" & sqlstr(loginname) & ", username=" & sqlstr(username) & ", password=" & sqlstr(password)
strsql = strsql & " where usersid=" & sqlstr(tuserid)
conn.execute(strsql)
'//新增方法
'//----------------------------(1)-------------------------------
set rsworkuserinfo = server.createobject("adodb.recordset")
strsql = "select usersid, loginname, username, password"
strsql = strsql & " from users"
strsql = strsql & " where usersid=" & sqlstr(tuserid)
if rsworkuserinfo.state = 1 then
rsworkuserinfo.close
end if
rsworkuserinfo.open strsql,conn,1,3
if rsworkuserinfo.eof then
rsworkuserinfo.addnew
rsworkuserinfo("usersid") = tuserid
rsworkuserinfo("loginname") = loginname
rsworkuserinfo("username") = username
rsworkuserinfo("password") = md5(password)
rsworkuserinfo.update
newrecord = true
else
newrecord = false
end if
rsworkuserinfo.close
set rsworkuserinfo = nothing
'//----------------------------(2)-------------------------------
strsql = "insert into users(usersid, loginname, username, password)"
strsql = strsql & " values(" & sqlstr(tuserid) & "," & sqlstr(loginname) & "," & sqlstr(username) & "," & sqlstr(password) & ")"
conn.execute(strsql)
'//刪除方法
'//----------------------------(1)-------------------------------
set rsworkuserinfo = server.createobject("adodb.recordset")
strsql = "delete from users"
strsql = strsql & " where usersid=" & sqlstr(tuserid)
if rsworkuserinfo.state = 1 then
rsworkuserinfo.close
end if
rsworkuserinfo.open strsql,conn,1,3
rsworkuserinfo.close
set rsworkuserinfo = nothing
'//----------------------------(2)-------------------------------
strsql = "delete from users"
strsql = strsql & " where usersid=" & sqlstr(tuserid)
conn.execute(strsql)
%>
C 對資料庫各種操作
using system using system.collections.generic using system.componentmodel using system.data using system.drawing using system.linq using system.text u...
C 對資料庫各種操作
using system using system.collections.generic using system.componentmodel using system.data using system.drawing using system.linq using system.text u...
對資料庫的操作
資料庫的檔案 資料檔案 包含資料和物件,主資料檔案建議副檔名.mdf,其餘.ndf 事務日誌檔案 包含恢復資料庫中的所有事物所需的資訊,建議副檔名.ldf 至少包含乙個資料檔案和乙個日誌檔案 對資料庫的操作 選其中乙個,可以選 選其中乙個,必選 分割,表示多個選項 表示說明 建立create dat...