|
- public function LogonName(dptName)
- dim i,j
- Dim Res,Cmd,sql
- Dim a,b
- Dim c,d
- datatable.addsheet("funLogonName")
- datatable.GetSheet("funLogonName").addparameter "DptName","0"
- datatable.GetSheet("funLogonName").addparameter "DptID","0"
- datatable.AddSheet("relativeUser")
- datatable.GetSheet("relativeUser").addparameter "LogonName","0"
-
- i=replace(dptName,"--","")
- datatable("DptName","funLogonName")=i
-
- Set Res=createobject("adodb.recordset")
- Set Cmd=createobject("adodb.command")
- Cmd.activeconnection="Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=fbm_jlmcc;Data Source=192.168.0.44"
- Cmd.CommandType = 1
- d=datatable("DptName","成功添加通知信息")
- sql="select DptID from CTM_DptList where DptName='"&i&"'"
- Cmd.CommandText = sql
- Set res = Cmd.Execute()
- j=res("DptID")
- datatable("DptID","funLogonName")=j
- Set res = nothing
- Set cmd.ActiveConnection = nothing
- Set Cmd= nothing '获取与选项匹配的DptID
- Set Res=createobject("adodb.recordset")
- Set Cmd=createobject("adodb.command")
- Cmd.activeconnection="Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=fbm_jlmcc;Data Source=192.168.0.44"
- Cmd.CommandType = 1
- sql="select LogonNme,PWD from ctm_userinfo where dptid in (select dptid from ctm_dptlist where vieworder like (select vieworder + '%' from ctm_dptlist where dptid='"&j&"')) "
- Cmd.CommandText = sql
- Set res = Cmd.Execute()
- a=0
- Do
- a=a+1
- datatable.GetSheet("relativeUser").SetCurrentRow(a)
- b=res("LogonName")
- res.movenext
- datatable("LogonName","ralativeUser")=b
- If a>30 Then
- Exit do
- End If
- loop While not res.eof
- Set res = nothing
- Set cmd.ActiveConnection = nothing
- Set Cmd= nothing '选取与DptID匹配的LogonName
- c=datatable.GetSheet("relativeUser").GetRowCount
- d=randomnumber.Value(1,c)
- datatable.GetSheet("relativeUser").SetCurrentRow(d)
- LogonName=datatable("LogonName","relativeUser")
- datatable.DeleteSheet("funLogonName")
- datatable.DeleteSheet("relativeUser")
- End Function
- Dim m,n
- n=browser("通知管理").Page("通知管理").Frame("frmMain").WebList("SelectBGTDpt1_ddlDpt").GetROProperty("value")
- msgbox(n)
- m=funLogonName(n)
- msgbox(m)
复制代码 |
|