sub init()
Objku ="./inc/qt.mdb"
Set Objconn = createobject("adodb.connection")
Objconn.open ="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Objku

exec="select * from userpw "
set rs=createobject("adodb.recordset")
rs.open exec,objconn
i=1
Do While Not rs.eof
Set objOption = Document.createElement("OPTION")
            objOption.Text = rs("name")
            objOption.Value = rs("password")
userpw.Add(objOption)
rs.movenext
i=i+1
Loop

exec="select * from bliao "
set rs=createobject("adodb.recordset")
rs.open exec,objconn
i=1
Do While Not rs.eof
Set objOption = Document.createElement("OPTION")
            objOption.Text = rs("name")
            objOption.Value = rs("hm")
bl.Add(objOption)
rs.movenext
i=i+1
Loop

exec="select * from yliao "
set rs=createobject("adodb.recordset")
rs.open exec,objconn
i=1
Do While Not rs.eof
Set objOption = Document.createElement("OPTION")
            objOption.Text = rs("name")
            objOption.Value = rs("hm")
yl.Add(objOption)
rs.movenext
i=i+1
Loop

exec="select * from xliao "
set rs=createobject("adodb.recordset")
rs.open exec,objconn
i=1
Do While Not rs.eof
Set objOption = Document.createElement("OPTION")
            objOption.Text = rs("name")
            objOption.Value = rs("hm")
xl.Add(objOption)
rs.movenext
i=i+1
Loop

rs.close
set rs=nothing
objconn.close
set objconn=nothing
end sub

sub addchat 
if cname.value="" then
msgbox("房间名称不能为空。")
cname.focus()
else if chm.value="" then 
msgbox("房间号码不能为空。")
chm.focus()
else 
objku ="./inc/qt.mdb"
Set Objconn = createobject("adodb.connection")
Objconn.open ="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Objku
exec="insert into " & addchats.value & "(name,hm)values('" & cname.value & "','" & chm.value & "')"
objconn.execute exec
objconn.close
set objconn=nothing
location.reload()
msgbox("添加成功")
end if
end if
end sub

sub delchat
if choosecrtype.value ="bliao" then 
del(bl.value)
else if choosecrtype.value ="yliao" then 
del(yl.value)
else if choosecrtype.value ="xliao" then 
del(xl.value)
end if 
end if 
end if 
end sub
function del(dhm) 
objku ="./inc/qt.mdb"
Set Objconn = createobject("adodb.connection")
Objconn.open ="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Objku
exec="delete * from " & choosecrtype.value & " where hm=(" & dhm & ")"
objconn.execute exec
objconn.close
set objconn=nothing
location.reload()
msgbox "删除成功！"
end function


sub adduserpw
objku ="./inc/qt.mdb"
Set Objconn = createobject("adodb.connection")
Objconn.open ="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Objku
exec="insert into userpw ([name],[password]) values('" & document.getElementById("User").value & "','" & document.getElementById("Pass").value & "')"
objconn.execute exec
objconn.close
set objconn=nothing
location.reload()
msgbox("添加成功")
end sub


sub deluser
objku ="./inc/qt.mdb"
Set Objconn = createobject("adodb.connection")
Objconn.open ="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Objku
exec="delete * from userpw where name=('" & document.getElementById("User").value & "')"
objconn.execute exec
objconn.close
set objconn=nothing
location.reload()
msgbox "删除成功！"
end sub

sub modify()
objku ="./inc/qt.mdb"
Set Objconn = createobject("adodb.connection")
Objconn.open ="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Objku
exec="UPDATE " & document.getElementById("choosecrtype").value & " SET name=('" & document.getElementById("chname").value & "'), hm=('" & document.getElementById("chhm").value & "') Where name=('" & document.getElementbyId("hichname").value & "')"
objconn.execute exec
objconn.close
set objconn=nothing
location.reload()
msgbox "修改成功！"
end sub


