end if
end if
End Function
''更新记录
Public Function Update_Table(Sql)
if not isempty(conn) or isnull(conn) then
call OpenConn(dbclass)
elseif conn.state = 0 then
call OpenConn(dbclass)
end if
on error resume next
if Sql <> "" then
conn.Execute Sql,Updated
if err then
Update_Table = false
err.clear
else
Update_Table = true
end if
Else
Update_Table = false
end if
conn.close
Set conn = nothing
End Function
''增加
''输入:insert SQL语句,表名,自增字段
Public Function Insert_Table(sql,table,id_column)
if not isempty(conn) or isnull(conn) then
call OpenConn(dbclass)
elseif conn.state = 0 then
call OpenConn(dbclass)
end if
on error resume next
if sql <> "" then
conn.Execute(sql)
if err then
Insert_Table = false:err.clear
else
Insert_Table = true
end if
''获得最后增加ID
if table <> "" and id_column <> "" then
Set ds = conn.Execute("select "&id_column&" from "&table&" order by "&id_column&" desc")
end if
if err then
Insertd = 0:err.clear
else Insertd = ds(0)
end if
Set ds = nothing
closed()
else
Insert_Table = false
end if
End Function
''关闭数据库链接
Public Function closed()
if not isempty(rs) and not isnull(rs) then
if rs.state = 1 then
rs.close
end if
end if
r