3.2 Get server folder information
We often need to get the folder structure information of the server. For example, the server is operated directly on the client to back up server data, or restore data. We need to choose to back up the file to which directory below, or choose to restore backups from that directory. Similar to this situation, here is not listed here, I will introduce how to use SQLDMO to get the folder information of the server.
We can get information from EnumavailableMedia (SqldMaMedia_fixedDisk) to get information under the subfolder under the current path through EnumDirectories (String Pathname). This information is returned to the QueryResults interface. Of course, we must first connect SQLSerVLASS objects to the database to be these methods.
Below is some descriptions of the above two methods:
l EnumavailableMedia (SqldMo.sqldMo_Media_TYPE): Enumeral to SQL Server, the parameter is an enumeration type, used to specify the type returned by the method, namely
u SqldMomedia_all Returns all types
u SqldMomedia_cdrom Returns the light drive list
u SqldMomedia_FixedDisk Returns a list of hard drives
u SqldMomedia_FLOPPY Return to the floppical list
u SqldMOMEDIA_SHAREDFIXEDDISK Return to Shared Hard Disk List
u sqldMomedia_tape Returns a list of tape devices
l EnumDirectories: Get the subfolder information, the parameter is the current folder path, returns a list of subfolders.
The following code demonstrates how to obtain server folder information:
public
Class
CSserveInfo
{Sqldmo.sqlserverclass isterver = null; / ** //// } Return AlTemp;} else {return null;}} / ** ////