|
Hola mira efectivamente eso es lo que estaba
haciendo. mira yo quiero crear el assemblie desde el MSSQL server y ya lo hice.
el problema que tengo es como declararle un storedprocedure para usar la
assemblie y que le pase el parametro. te paso la clase y a lo mejor tu sabes
como delcararle el storedprocedure el lio es que el tiene que pasarle parametros
a la clase del assemblie y no tengo la menor idea de hacer esto.
gracias
esta es la clase del assemblie y recibe un string
como parametro.
using System;using System.Collections.Generic;using System.Text;using System.IO.Compression;using System.IO;namespace compactar{ class Compactar{ public bool GZipCompress(string filename){ FileStream infile; bool bien = false; try{ // Open the file as a FileStream object.infile = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read); byte[] buffer = new byte[infile.Length]; // Read the file to ensure it is readable. int count = infile.Read(buffer, 0, buffer.Length); if (count != buffer.Length){ infile.Close(); throw new ApplicationException("Unable to read data from file"); return bien = false;} infile.Close(); FileStream ms = new FileStream(filename + ".gz", FileMode.CreateNew); // Use the newly created memory stream for the compressed data. GZipStream compressedzipStream = new GZipStream(ms, CompressionMode.Compress, true);compressedzipStream.Write(buffer, 0, buffer.Length); // Close the stream.compressedzipStream.Close(); ms.Close(); ms.Dispose(); File.Delete(filename); return bien = true;} // end try catch (InvalidDataException){ //Console.WriteLine("Error: The file being read contains invalid data."); return bien = false;} catch (FileNotFoundException){ //Console.WriteLine("Error:The file specified was not found."); return bien = false;} catch (ArgumentException){ //Console.WriteLine("Error: path is a zero-length string, contains only white space, or contains one or more invalid characters"); return bien = false;} catch (PathTooLongException){ //Console.WriteLine("Error: The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters."); return bien = false;} catch (DirectoryNotFoundException){ //Console.WriteLine("Error: The specified path is invalid, such as being on an unmapped drive."); return bien = false;} catch (IOException){ //Console.WriteLine("Error: An I/O error occurred while opening the file."); return bien = false;} catch (UnauthorizedAccessException){ //Console.WriteLine("Error: path specified a file that is read-only, the path is a directory, or caller does not have the required permissions."); return bien = false;} catch (IndexOutOfRangeException){ //Console.WriteLine("Error: You must provide parameters for MyGZIP."); return bien = false;} }
}
}
|
