sheet.Cells[0, 0].Value = string.Format("{0} database dictionary", db);
sheet.Cells[4, 0].Value = "Name";
sheet.Cells[4, 0].Style = nameStyle;
sheet.Cells[4, 1].Value = "Dependencies";
sheet.Cells[4, 1].Style = nameStyle;
sheet.Cells[4, 2].Value = "Type";
sheet.Cells[4, 2].Style = nameStyle;
string connectionString = string.Format("Password={0};Persist Security Info=True;User ID=sa;Initial Catalog={1};Data Source={2}", password, db, dataSource);
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
sheet.Cells[5, 0].Value = "Stored Procedures";
sheet.Cells[5, 0].Style = typeStyle;
DataSet data = new DataSet();
using (SqlCommand command = new SqlCommand("SELECT * FROM sysobjects WHERE XTYPE='p' ORDER BY NAME", connection))
{
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(data);
DataTable objects = data.Tables[0];
int index = 6;
for (int i = 0; i < objects.Rows.Count; i++)
{
string objectName = objects.Rows[i]["name"].ToString();
sheet.Cells[index, 0].Value = objectName;
sheet.Cells[index, 0].Style = itemStyle;
DataSet data2 = new DataSet();
using (SqlCommand command2 = new SqlCommand(string.Format("exec sp_depends '{0}'", objectName), connection))
{
adapter = new SqlDataAdapter(command2);
adapter.Fill(data2);
}
if (data2.Tables.Count > 0)
{
DataTable dependencies = data2.Tables[0];
Dictionary
for (int j = 0; j < dependencies.Rows.Count; j++)
{
string itemName = dependencies.Rows[j]["name"].ToString();
if (!uniqueDependencies.ContainsKey(itemName))
uniqueDependencies.Add(itemName, new KeyValuePair
}
北京 | 天津 | 上海 | 江蘇 | 山東 |
安徽 | 浙江 | 江西 | 福建 | 深圳 |
廣東 | 河北 | 湖南 | 廣西 | 河南 |
海南 | 湖北 | 四川 | 重慶 | 云南 |
貴州 | 西藏 | 新疆 | 陜西 | 山西 |
寧夏 | 甘肅 | 青海 | 遼寧 | 吉林 |
黑龍江 | 內(nèi)蒙古 |