在线求助 odbc 驱动程序不支持所需的属性 80040E21
Set conn1 = CreateObject("adodb.Connection")connstr = "DSN=dd;datebase=humanresource;uid=sa;pwd=1234"
conn1.Open connstr
'conn1.execute("update checkinout set UserExtFmt='0'")
set rs1=createobject("ADodb.recordset")
sql="select t_attrecord.checkdate+' '+t_attrecord.checktime,t_employee.employeename as name1,t_attrecord.attrecordid as userid,left(t_attrecord.checktype,4) as ctp from dbo.t_attrecord,t_employee where t_attrecord.employeeid=t_employee.employeeid and t_attrecord.nn='0'"
rs1.open sql,conn1,1,1
do while not rs1.eof
tt=6
aa=datediff("s",FormatDateTime(rs1(0),4),"19:20")
if aa>0 then
tt=5
end if
aa=datediff("s",FormatDateTime(rs1(0),4),"18:20")
if aa>0 then
tt=4
end if
aa=datediff("s",FormatDateTime(rs1(0),4),"14:30")
if aa>0 then
tt=3
end if
aa=datediff("s",FormatDateTime(rs1(0),4),"12:30")
if aa>0 then
tt=2
end if
aa=datediff("s",FormatDateTime(rs1(0),4),"9:00")
if aa>0 then
tt=1
end if
if rs1("name1")<>"" then
cname=getname(rs1("name1"),rs1("userid"))
aa=writeduty(cname,tt,rs1(0),rs1("ctp"))
end if
conn1.execute("update t_attrecord set nn='1' where attrecordid="&rs1("userid"))
rs1.movenext
loop
set rs1=nothing
set conn1=nothing
function getname(cna,id)
'getname="prv" & id
getname=""
strconnection="driver={MySQL ODBC 5.1 Driver};database=TD_OA;server=localhost;PORT=3336;uid=root;password=myoa888"
set conn=createobject("adodb.connection")
set rs=createobject("ADodb.recordset")
conn.open strconnection
sql="select USER_ID from `user` where `USER_NAME`="""&cna&""" "
rs.open sql,conn,1,1
if rs.eof then
'conn.execute("delete from user where `USER_ID`="""&getname&""" ")
'sql="INSERT INTO `user` ( `UID` , `USER_ID` , `USER_NAME` , `BYNAME` , `USEING_KEY` , `USING_FINGER` , `PASSWORD` , `KEY_SN` , `SECURE_KEY_SN` , `USER_PRIV` , `POST_PRIV` , `POST_DEPT` , `DEPT_ID` , `DEPT_ID_OTHER` , `SEX` , `BIRTHDAY` , `IS_LUNAR` , `TEL_NO_DEPT` , `FAX_NO_DEPT` , `ADD_HOME` , `POST_NO_HOME` , `TEL_NO_HOME` , `MOBIL_NO` , `BP_NO` , `EMAIL` , `OICQ_NO` , `ICQ_NO` , `MSN` , `NICK_NAME` , `AVATAR` , `CALL_SOUND` , `BBS_SIGNATURE` , `BBS_COUNTER` , `DUTY_TYPE` , `LAST_VISIT_TIME` , `SMS_ON` , `MENU_TYPE` , `UIN` , `PIC_ID` , `AUTHORIZE` , `CANBROADCAST` , `DISABLED` , `MOBILE_SP` , `MOBILE_PS1` , `MOBILE_PS2` , `LAST_PASS_TIME` , `THEME` , `SHORTCUT` , `PORTAL` , `PANEL` , `ONLINE` , `ON_STATUS` , `USER_DEFINE` , `MOBIL_NO_HIDDEN` , `MYTABLE_LEFT` , `MYTABLE_RIGHT` , `EMAIL_CAPACITY` , `FOLDER_CAPACITY` , `USER_PRIV_OTHER` , `USER_NO` , `NOT_LOGIN` , `NOT_VIEW_USER` , `NOT_VIEW_TABLE` , `NOT_SEARCH` , `BKGROUND` , `BIND_IP` , `LAST_VISIT_IP` , `MENU_IMAGE` , `WEATHER_CITY` , `SHOW_RSS` , `MY_RSS` , `REMARK` , `MENU_EXPAND` , `WEBMAIL_CAPACITY` , `WEBMAIL_NUM` , `MY_STATUS` , `SCORE` , `TDER_FLAG` , `CONCERN_USER` , `LIMIT_LOGIN` , `PHOTO` , `IM_RANGE` ) VALUES ('', '"&getname&"', '"&cna&"', '', '0', '0', '$1$vf5.MQ..$aEAvp4VuD0FQblzsndC4P.', '', '', '21', '0', '', '81', '', '', '0000-00-00', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '0', '0000-00-00 00:00:00', '', '1', '0', '0', '0', '0', '0', '', '', '', '0000-00-00 00:00:00', '1', '', '', '1', '0', '1', '', '0', 'ALL', 'ALL', '0', '0', '', '10', '0', '0', '0', '0', '', '', '', '0', '', '1', '', '', '', '0', '0', '', '0', '', '', '0', '', '1');"
'Wscript.Echo sql
'sql="INSERT INTO `user` VALUES ('"&getname&"', '"&cna&"', '', '$1$vf5.MQ..$aEAvp4VuD0FQblzsndC4P.', '21', '0', '', 81, '0', '0000-00-00 00:00:00', '', '', '', '', '', '', '', '', '', '', '', '', '1', '1', '', 0, 1, '0000-00-00 00:00:00', '1', '1', '2', 0, 0, 0, 0, 0, '', '', '', '0000-00-00 00:00:00', '1', '', '1', 0, '1', '', '1', 'ALL', 'ALL', 100, 100, '', 10, '0', '0', '0', '', '')"
'conn.execute(sql)
else
getname=rs(0)
end if
set rs=nothing
set conn=nothing
end function
function writeduty(cname,tt,tima,ctp)
ctp="192.168.1.254"
if cname<>"" then
strconnection="driver={MySQL ODBC 5.1 Driver};database=TD_OA;server=localhost;PORT=3336;uid=root;password=myoa888"
set conn=createobject("adodb.connection")
set rs=createobject("ADodb.recordset")
conn.open strconnection
sql="select * from attend_duty where USER_ID="""&cname&""" and REGISTER_TYPE="""&tt&""" and REGISTER_TIME="""&tima&""" "
rs.open sql,conn,1,1
if rs.eof then
conn.execute("INSERT INTO `attend_duty` VALUES ('"&cname&"', '"&tt&"', '"&tima&"', '"&ctp&"', '',1);")
end if
rs.close()
set rs=nothing
set conn=nothing
end if
end function