Problema para puxar uma imagem Banco de dados (GDB) Firebird
08/08/2016
0
Ola pessoal estou tendo serio problema de como fazer uma busca e inserir imagem de um produto no C# o banco de dados esta em GBD ou firebir podem me ajuda por favor
a conexao esta da seguinte forma:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FirebirdSql.Data.FirebirdClient;
namespace Doma
{
public static class conexaofb
{
static FbConnection conexaoFB;
public static FbConnection conexao
{
get
{
return conexaoFB;
}
}
public static bool Conectar()
{
string strConexao;
strConexao = "User=SYSDBA;" +
"Password=masterkey;" +
"Database=C:\\teste\\ONCLICK.GDB;" +
"Database=C:\\teste\\OCSFOTOS.GDB;" +
"Port=3050;" +
"Dialect=3;" +
"Charset=NONE;" +
"Role=;" +
"Connection timeout=7;" +
"Connection lifetime=0;" +
"Pooling=true;" +
"Pocket Size=8192;" +
"Server Type=0";
conexaoFB = new FbConnection(strConexao);
conexaoFB.Open();
return true;
}
public static bool Desconectar()
{
conexaoFB.Close();
conexaoFB = null;
return false;
}
}
}
e estou tentando puxar a imagem da seguinte forma
private void button1_Click(object sender, EventArgs e)
{
conexaofb.Conectar();
FbCommand comandoSQL = new FbCommand("select foto.foto "+ textBox2 +" from foto where foto.nomefoto", conexaofb.conexao);
DataTable clientes = new DataTable();
clientes.Load(comandoSQL.ExecuteReader());
pictureBox3.Show();
conexaofb.Desconectar();
}
a conexao esta da seguinte forma:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FirebirdSql.Data.FirebirdClient;
namespace Doma
{
public static class conexaofb
{
static FbConnection conexaoFB;
public static FbConnection conexao
{
get
{
return conexaoFB;
}
}
public static bool Conectar()
{
string strConexao;
strConexao = "User=SYSDBA;" +
"Password=masterkey;" +
"Database=C:\\teste\\ONCLICK.GDB;" +
"Database=C:\\teste\\OCSFOTOS.GDB;" +
"Port=3050;" +
"Dialect=3;" +
"Charset=NONE;" +
"Role=;" +
"Connection timeout=7;" +
"Connection lifetime=0;" +
"Pooling=true;" +
"Pocket Size=8192;" +
"Server Type=0";
conexaoFB = new FbConnection(strConexao);
conexaoFB.Open();
return true;
}
public static bool Desconectar()
{
conexaoFB.Close();
conexaoFB = null;
return false;
}
}
}
e estou tentando puxar a imagem da seguinte forma
private void button1_Click(object sender, EventArgs e)
{
conexaofb.Conectar();
FbCommand comandoSQL = new FbCommand("select foto.foto "+ textBox2 +" from foto where foto.nomefoto", conexaofb.conexao);
DataTable clientes = new DataTable();
clientes.Load(comandoSQL.ExecuteReader());
pictureBox3.Show();
conexaofb.Desconectar();
}
Michel Pinheiro
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)