XML and Internet Support
Creating the nwind Virtual Directory Using the Object Model
This Microsoft® Visual Basic® Scripting Edition (VBScript) sample creates the same nwind virtual directory that is described in Creating the nwind Virtual Directory.
Set ObjXML = CreateObject("SQLVDir.SQLVDirControl")
ObjXML.Connect 'Connect to the local computer and Web site "1"
Set ObjVDirs = ObjXML.SQLVDirs
Set ObjVDir = ObjVDirs.AddVirtualDirectory("nwind")
'General tab in UI
ObjVDir.PhysicalPath = "C:\Inetpub\wwwroot\nwind"
'Security tab in UI
ObjVDir.UserName = "sa" 'SQL Server login
ObjVDir.Password = "" 'SQL Server Password (is "" per default)
'Data source tab in UI
'(local) is default for the SQL Server
ObjVDir.DatabaseName = "Northwind"
'Settings tab in UI
objVDir.AllowFlags = 73 'afURL_QUERIES OR afTEMPLATES OR afXPath
'Virtual Name Configuration tab in the UI
Set objVNames = objVDir.VirtualNames
objVNames.AddVirtualName "dbobject", 1, ""
objVNames.AddVirtualName "schema", 2, "C:\Inetpub\wwwroot\nwind\schema"
objVNames.AddVirtualName "template", 4 , "C:\Inetpub\wwwroot\nwind\template"
'Disconnect from the server.
objXML.Disconnect
msgbox "Done."