2012-05-24 50 views

回答

2

報表服務器使用名爲FindObjectsNonRecursive的存儲過程。

string cnxstr = "Data Source=server;Initial Catalog=ReportServer;Integrated Security=SSPI;"; //connection string 
using (SqlConnection connection = new SqlConnection(cnxstr)) 
{ 
    connection.Open(); 
    SqlCommand command = new SqlCommand(); 
    command.Connection = connection; 
    command.CommandType = CommandType.StoredProcedure; 
    command.CommandText = "FindObjectsNonRecursive"; 
    command.Parameters.Add(new SqlParameter("@Path", "/folder_name")); 
    command.Parameters.Add(new SqlParameter("@AuthType", 1)); 
    SqlDataReader reader = null; 
    try 
    { 
     reader = command.ExecuteReader(); 
     while (reader.Read()) 
     { 
      string path = reader["Path"].ToString(); 
      //now you can display this path in your list, or do whatever 
     } 
    } 
    finally 
    { 
     if (reader != null) 
      reader.Close(); 
    } 
} 
相關問題