XML and SQL Server 2000

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."

Категории