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;

}

}

 

}

 

}

 
 
----- Original Message -----
Sent: Friday, November 03, 2006 9:17 AM
Subject: [dbms] Re: Re: [dbms] RE: [dbms] RE: [dbms] duda con Assemblie y clr , permisos y ¿como hacer un backup desde la aplicacion?

Si lo creas con el VS no vas a poder cambiar desde el management Studio.  Además si lo compilas en debug te sube toda la información de debug al server. Mi sugerencia es que cree el assembly desde el MA. ST 
En T-SQL tienes la instrucción BACKUP DATABASE que me parece muy fácil de usar para hacer backups .
El cambiar el modo de seguridad del assembly es una propiedad del proyecto (no de la solución) y es peligroso y no sugerido, pero se puede usar, pero toma en cuenta que lo cambia el modo para todos los métodos estáticos del assembly !!!!
 
Mas allá del modo de seguridad que impide el acceso a ciertas partes del sistema, lo que esta restringido en el CLR es que assemblies se pueden cargar y por lo tanto que clases se pueden instanciar desde el runtime host del SQL Server 2005 (Por ejemplo clases relacionadas a ASP.NET i, threads, etc no se pueden instanciar).
 
Saludos

--
--------------------------------
Atte.
Ing. Jose Mariano Alvarez

Responder a