Ver Mensaje Individual
  #2  
Antiguo 30-05-2011
Avatar de marcoszorrilla
marcoszorrilla marcoszorrilla is offline
Capo
 
Registrado: may 2003
Ubicación: Cantabria - España
Posts: 11.221
Reputación: 10
marcoszorrilla Va por buen camino
No tengo tiempo, para mirarlo, pero echalo un ojo por si te puede servir de base.
Código SQL [-]
               BLOB Reading Example (C#)             

                                                TEST.SQL Script (Testing Database)

 Run the following script to create the testing database. It creates a simple table called MYTABLE with a single row. (How to create a database from an SQL script):
CREATE TABLE MYTABLE (     ID   INTEGER,     VAL  BLOB SUB_TYPE 0 SEGMENT SIZE 80 ); Reading values

 Because it is not possible to insert binary BLOB value in the SQL script we need to insert it in the code before reading.
 The following sample prints the values from the column "VAL" to console:
string database = "test.fdb";  CreateEmbeddedDb(database, "test.sql");  FbConnectionStringBuilder csb = new FbConnectionStringBuilder(); csb.ServerType = 1; csb.Database = database;  using (FbConnection c = new FbConnection(csb.ToString())) {   c.Open();          FbCommand cmdInsert = new FbCommand("INSERT INTO mytable(id, val) VALUES(@id, @val)", c);   cmdInsert.Parameters.Add("@id", 1);   cmdInsert.Parameters.Add("@val", new byte[] {1, 2, 3});   cmdInsert.ExecuteNonQuery();    FbCommand cmd = new FbCommand("SELECT val FROM mytable", c);            using (FbDataReader r = cmd.ExecuteReader())   {     while (r.Read())     {       int size = 20;       byte[] bytes = new byte[size];       long count = r.GetBytes(0, 0, bytes, 0, size);       for(int i = 0; i < count; i++)         Console.WriteLine("Value: " + bytes[i]);     }   } } 


             
                            
             Copyright © 2005 - 2007 DotNetFirebird
Un Saludo.
__________________
Guía de Estilo de los Foros
Cita:
- Ça c'est la caisse. Le mouton que tu veux est dedans.
Responder Con Cita