VBS指令碼運算元據庫的例子

2021-04-25 18:15:27 字數 1425 閱讀 6447

'更新組織結構

set bpmobjconnection = createobject("adodb.connection")

'使用之前建立乙個odbc dsn 並制定使用者名稱密碼

bpmobjconnection.open "dsn=oracle;","bpm","bpm"

' specify base ou.

strou = "ou=1_useraccount,dc=cu,dc=local"

' bind to base ou.

set objou = getobject("ldap://" & strou)

' enumerate groups in ou.

call enumou(objou, "")

'遞迴函式遍歷

function enumou(byval objadcontainer, byval stroffset,byval upou)

' recursive subroutine to enumerate groups in the ou

' and all child ou's.

dim objgroup, objchild

' output name of ou.

'wscript.echo stroffset & "ou: " & objadcontainer.distinguishedname

' enumerate child ou's.

objadcontainer.filter = array("organizationalunit")

for each objchild in objadcontainer

'update oracle

'setup value    

'fuego_modifier="uaes"

'fuego_crtime="sysdate"

pou=upou

pname=objchild.ou

objcn.cursorlocation = 3   '引數都不能寫成常量的形勢,必須要寫成整型

set adocomm = createobject("adodb.command")

with adocomm

.activeconnection = objcn

.commandtype = 4

.commandtext = "updatebpmou"

rs=createobject("adodb.recordset")'儲存過程返回的游標

set rs = .execute()

end with

'end update oracle

call enumou(objchild, stroffset & " ",upou)

next

end function

bpmobjconnection.close

python運算元據庫指令碼

import pymysql class operationmysql 資料庫sql相關操作 import pymysql db pymysql.connect localhost testuser test123 testdb cursor db.cursor cursor.execute sel...

運算元據庫的常用sql指令碼

1.增加字段 alter table docdsp add dspcode char 200 2.刪除字段 alter table table name drop column column name 3.修改字段型別 alter table table name alter column colu...

運算元據庫

python importmysqldb defmydbtest conn mysqldb.connect host localhost user root passwd sa db b4img charset utf8 cursor conn.cursor sql select from imag...