创建一个SDE连接
创建一个SDE连接,并返回其路径;得到的路径可用于geoprocessing充当SDE connection path.
Private Function fnCreateWS(strDate As String) As String
Dim ps As IPropertySet
Set ps = New PropertySet
With ps
Call .SetProperty("Server", "a")
Call .SetProperty("Instance", gobjLogin.sdeInstance)
Call .SetProperty("Database", "a")
Call .SetProperty("user", gobjLogin.stagingUser)
Call .SetProperty("password", gobjLogin.stagingPassword)
Call .SetProperty("version", "sde.DEFAULT")
Dim wsf As IWorkspaceFactory
Set wsf = New SdeWorkspaceFactory
Dim wsn As IWorkspaceName
Set wsn = wsf.Create(App.Path & "\", strDate & ".sde", ps, 0)
Dim name As IName
Set name = wsn
Dim ws As IWorkspace
Set ws = name.Open
fnCreateWS = ws.PathName
End With
End Function
Dim ps As IPropertySet
Set ps = New PropertySet
With ps
Call .SetProperty("Server", "a")
Call .SetProperty("Instance", gobjLogin.sdeInstance)
Call .SetProperty("Database", "a")
Call .SetProperty("user", gobjLogin.stagingUser)
Call .SetProperty("password", gobjLogin.stagingPassword)
Call .SetProperty("version", "sde.DEFAULT")
Dim wsf As IWorkspaceFactory
Set wsf = New SdeWorkspaceFactory
Dim wsn As IWorkspaceName
Set wsn = wsf.Create(App.Path & "\", strDate & ".sde", ps, 0)
Dim name As IName
Set name = wsn
Dim ws As IWorkspace
Set ws = name.Open
fnCreateWS = ws.PathName
End With
End Function
-----------------------------------------------------------
佛对我说:你心里有尘。我用力的拭擦。