Creating a Virtual Directory Using the Object Model


Using the physical directory structure we created earlier and incorporating the code snippets presented to this point, we can now work through a complete example to create all the components we have talked about in this chapter. This example is Listing 3.7. If you need to, refer to the comments of the code snippets to explain what's going on.

Listing 3.7 Complete Example of Creating a Virtual Directory
 Set ObjXML = Server.CreateObject("SQLVDir.SQLVDirControl")  ObjXML.Connect                      'Connect to the local computer and Web site  "1"  Set ObjDirs = ObjXML.SQLVDirs  Set ObjDir = ObjDirs.AddVirtualDirectory("northwind")  'General tab in UI  ObjDir.PhysicalPath = "C:\Inetpub\wwwroot\northwind"  'Security tab in UI  ObjDir.UserName = "sa" 'SQL Server login  ObjDir.Password = ""   'SQL Server Password (blank by default)  'Data source tab in UI  '(local) is default for the SQL Server  ObjDir.DatabaseName = "Northwind"  'Settings tab in UI  objDir.AllowFlags = 73 'URL_QUERIES OR TEMPLATES OR XPath  'Virtual Name Configuration tab in the UI  Set objNames = objDir.VirtualNames  objNames.AddVirtualName "dbobject", 1, ""  objNames.AddVirtualName "schema", 2, "C:\Inetpub\wwwroot\northwind\schema"  objNames.AddVirtualName "template", 4 , "C:\Inetpub\wwwroot\northwind\template"  objXML.Disconnect   'Disconnect from the server.  msgbox "Done." 


XML and SQL Server 2000
XML and SQL Server 2000
ISBN: 0735711127
EAN: 2147483647
Year: 2005
Pages: 104
Authors: John Griffin

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net