[c#]代码库
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.IO.Compression;
using System.Text;
SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=SSISDB;Integrated Security=True;");
con.Open();
SqlCommand cmd = new SqlCommand("[catalog].[get_project]", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@folder_name", SqlDbType.NVarChar).Value = "GCDF";
cmd.Parameters.Add("@project_name", SqlDbType.NVarChar).Value = "GCDF_CLC";
try
{
MemoryStream ms = new MemoryStream((byte[])cmd.ExecuteScalar());
using (ZipArchive zip = new ZipArchive(ms))
{
foreach (ZipArchiveEntry entry in zip.Entries)
{
if (Path.GetExtension(entry.FullName) == ".dtsx")
{
Stream s = entry.Open();
byte[] buffer = new byte[entry.Length];
int ret = s.Read(buffer, 0, (int)entry.Length);
if (ret > -1)
{
string content = Encoding.UTF8.GetString(buffer);
}
}
break;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
if (con.State == ConnectionState.Open)
con.Close();
}
by: 发表于:2017-12-27 10:08:55 顶(0) | 踩(0) 回复
??
回复评论