|
convert SSIS VB скрипт на VB2010
|
|||
---|---|---|---|
#18+
Приветствую. Обновил SQL server до 2012 - возникла проблема - была работа написана на vb (скрипт), пытаюсь вставить этот скрипт на 2010 - ругается. Паралельно такую же написал на powershell, но она отрабатывает 40 минут, тогда как на старом vb 2 минуты. Поэтому всё же хотелось бы перевести старый скрипт до 2010 уровня. Спасибо Ниже текст скрипта Sub Logger(PackName,LogN,LogDescr) 'msgbox Now & " | " & PackName & " | " & LogDescr & " | #" & LogN Set oFS=CreateObject("Scripting.FileSystemObject") Set oListFile = oFS.OpenTextFile("D:\Admin\Attributes.log",8,True) LogM=Now & " | " & PackName & " | " & LogDescr & " | #" & LogN oListFile.WriteLine LogM oListFile.Close Set oListFile = Nothing Set oFS=Nothing end sub Function Main() Logger "Syncro Attributes",0,"Begin" Const SQLSRVName = "SQL" Const SQLDBName = "Admin" Const ADS_PROPERTY_APPEND = 3 Dim i Set objRootDSE = GetObject("LDAP://DC=Domain") Set adoCN = CreateObject("ADODB.Connection") adoCN.Provider = "sqloledb" adoCN.Properties("Data Source").Value = SQLSRVName adoCN.Properties("Initial Catalog").Value = SQLDBName adoCN.Properties("Integrated Security").Value = "SSPI" adoCN.Open vSQLStr = "SELECT ADsPath, compid, IsTyphoonUser, isregional FROM v_Attribute" Set adoRS = adoCN.Execute(vSQLStr) i = 0 Do While Not adoRS.EOF ADsPath = adoRS(0) compid = adoRS(1) IsTyphoonUser = adoRS(2) isregional = adoRS(3) Set objUser = GetObject(ADsPath) If Not IsNull(compid) Then objUser.Put "extensionAttribute2", compid Logger "Written compid",i,compid End If If Not IsNull(IsUser) Then objUser.Put "extensionAttribute1", IsUser Logger "Written IsUser",i,IsUser End If If Not IsNull(isregional) Then objUser.Put "extensionAttribute3",isregional End If Logger "isregional",i,isregional i = i + 1 ON Error Resume NEXT Logger "Error",Error.Number, Error.Description objUser.SetInfo Set objUser = Nothing adoRS.MoveNext Loop adoRS.Close adoCN.Close Set adoRS = Nothing Set adoCN = Nothing Set objRootDSE = Nothing Main = DTSTaskExecResult_Success End Function ... |
|||
:
Нравится:
Не нравится:
|
|||
21.12.2012, 15:16 |
|
convert SSIS VB скрипт на VB2010
|
|||
---|---|---|---|
#18+
maestroukr, ну во первых где ругается, скрины, номера строк. Также раз будет VB 10.0, то надо писать код соответствующе, например типы объявить правильно и везде. Если консольное приложение то полностью приведите код с названиями классов и импортов. ... |
|||
:
Нравится:
Не нравится:
|
|||
21.12.2012, 17:23 |
|
convert SSIS VB скрипт на VB2010
|
|||
---|---|---|---|
#18+
VSVLAD, Извините я просто с VB пока что не дружу - так понял что придётся :), я думал что может немного можно синтаксис подправить и всё. ... |
|||
:
Нравится:
Не нравится:
|
|||
21.12.2012, 17:46 |
|
convert SSIS VB скрипт на VB2010
|
|||
---|---|---|---|
#18+
VSVLAD, 1-а я ошибка 'Public Sub Main()' and 'Public Function Main() As Object' cannot overload each other because they differ only by return types. Далее 60 ошибок что всё не declared. Буду читать мануалы. Спасибо. ... |
|||
:
Нравится:
Не нравится:
|
|||
21.12.2012, 17:51 |
|
|
start [/forum/topic.php?fid=20&msg=38088599&tid=1405451]: |
0ms |
get settings: |
11ms |
get forum list: |
15ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
64ms |
get topic data: |
9ms |
get forum data: |
3ms |
get page messages: |
50ms |
get tp. blocked users: |
2ms |
others: | 13ms |
total: | 175ms |
0 / 0 |