6 个解决方案
#1
不大清楚,我在用时就没问题不过我是ORICGER + PB8
#2
MySQL默认设置不支持大于2.7m的二进制数据,
你需要在MySQL中设置
你需要在MySQL中设置
#3
我用的也是MySQL与Delphi,
请问你用的是什么联接控件呀,
我用的是TMySQL
你怎么实现存储二进制文件的呢
请问你用的是什么联接控件呀,
我用的是TMySQL
你怎么实现存储二进制文件的呢
#4
我用的是TMySQL.Components,在网站http://www.fichtner.net/delphi/mysql/上下的,略进我的修改,
实现存储的代码如下:
{本程序已实现了图像从mysql数据库存入和读出
作者:刘志强
image表:
code char 10,
image longblob }
unit Unit119;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, MySQLDataset, Grids, DBGrids, MySQLServer, StdCtrls, DBCtrls;
type
TForm1 = class(TForm)
MySQLServer1: TMySQLServer;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
MySQLQuery1: TMySQLQuery;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Buffer: PChar;
fd: Integer;
Stream: TMySQLBlobStream;
bmp:TBitmap;
flen:Int64;
begin
bmp:=TBitmap.Create;
try
//向Mysql表写入Bmp图像
bmp.LoadFromFile('c:\program files\common files\borland shared\Images\Splash\256color\factory.bmp');
MySQLQuery1.Open;
MySQLQuery1.Append;
MySQLQuery1.FieldByName('code').AsString:='刘志12';
MySQLQuery1.FieldbyName('image').Assign(bmp);
MySQLQuery1.TableName:='image';
MySQLQuery1.post;
//从Mysql表读出Bmp图像
MySQLQuery1.close;
MySQLQuery1.SQl.Clear;
MySQLQuery1.SQL.Add('select * from image where code="刘志12"');
MySQLQuery1.Open;
MySQLQuery1.Next;
MySQLQuery1.Edit;
Stream := TMySQLBlobStream.Create(MySQLQuery1.FieldByName('Image') as TBlobField, bmReadWrite);
bmp.LoadFromStream(stream);
canvas.Draw(0,0,bmp);
finally
Stream.Free;
bmp.Free;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
bmp:TBitmap;
stream:TMySQLBlobStream;
begin
end;
end.
实现存储的代码如下:
{本程序已实现了图像从mysql数据库存入和读出
作者:刘志强
image表:
code char 10,
image longblob }
unit Unit119;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, MySQLDataset, Grids, DBGrids, MySQLServer, StdCtrls, DBCtrls;
type
TForm1 = class(TForm)
MySQLServer1: TMySQLServer;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
MySQLQuery1: TMySQLQuery;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Buffer: PChar;
fd: Integer;
Stream: TMySQLBlobStream;
bmp:TBitmap;
flen:Int64;
begin
bmp:=TBitmap.Create;
try
//向Mysql表写入Bmp图像
bmp.LoadFromFile('c:\program files\common files\borland shared\Images\Splash\256color\factory.bmp');
MySQLQuery1.Open;
MySQLQuery1.Append;
MySQLQuery1.FieldByName('code').AsString:='刘志12';
MySQLQuery1.FieldbyName('image').Assign(bmp);
MySQLQuery1.TableName:='image';
MySQLQuery1.post;
//从Mysql表读出Bmp图像
MySQLQuery1.close;
MySQLQuery1.SQl.Clear;
MySQLQuery1.SQL.Add('select * from image where code="刘志12"');
MySQLQuery1.Open;
MySQLQuery1.Next;
MySQLQuery1.Edit;
Stream := TMySQLBlobStream.Create(MySQLQuery1.FieldByName('Image') as TBlobField, bmReadWrite);
bmp.LoadFromStream(stream);
canvas.Draw(0,0,bmp);
finally
Stream.Free;
bmp.Free;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
bmp:TBitmap;
stream:TMySQLBlobStream;
begin
end;
end.
#5
怎样设置?
#6
如何
#1
不大清楚,我在用时就没问题不过我是ORICGER + PB8
#2
MySQL默认设置不支持大于2.7m的二进制数据,
你需要在MySQL中设置
你需要在MySQL中设置
#3
我用的也是MySQL与Delphi,
请问你用的是什么联接控件呀,
我用的是TMySQL
你怎么实现存储二进制文件的呢
请问你用的是什么联接控件呀,
我用的是TMySQL
你怎么实现存储二进制文件的呢
#4
我用的是TMySQL.Components,在网站http://www.fichtner.net/delphi/mysql/上下的,略进我的修改,
实现存储的代码如下:
{本程序已实现了图像从mysql数据库存入和读出
作者:刘志强
image表:
code char 10,
image longblob }
unit Unit119;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, MySQLDataset, Grids, DBGrids, MySQLServer, StdCtrls, DBCtrls;
type
TForm1 = class(TForm)
MySQLServer1: TMySQLServer;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
MySQLQuery1: TMySQLQuery;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Buffer: PChar;
fd: Integer;
Stream: TMySQLBlobStream;
bmp:TBitmap;
flen:Int64;
begin
bmp:=TBitmap.Create;
try
//向Mysql表写入Bmp图像
bmp.LoadFromFile('c:\program files\common files\borland shared\Images\Splash\256color\factory.bmp');
MySQLQuery1.Open;
MySQLQuery1.Append;
MySQLQuery1.FieldByName('code').AsString:='刘志12';
MySQLQuery1.FieldbyName('image').Assign(bmp);
MySQLQuery1.TableName:='image';
MySQLQuery1.post;
//从Mysql表读出Bmp图像
MySQLQuery1.close;
MySQLQuery1.SQl.Clear;
MySQLQuery1.SQL.Add('select * from image where code="刘志12"');
MySQLQuery1.Open;
MySQLQuery1.Next;
MySQLQuery1.Edit;
Stream := TMySQLBlobStream.Create(MySQLQuery1.FieldByName('Image') as TBlobField, bmReadWrite);
bmp.LoadFromStream(stream);
canvas.Draw(0,0,bmp);
finally
Stream.Free;
bmp.Free;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
bmp:TBitmap;
stream:TMySQLBlobStream;
begin
end;
end.
实现存储的代码如下:
{本程序已实现了图像从mysql数据库存入和读出
作者:刘志强
image表:
code char 10,
image longblob }
unit Unit119;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, MySQLDataset, Grids, DBGrids, MySQLServer, StdCtrls, DBCtrls;
type
TForm1 = class(TForm)
MySQLServer1: TMySQLServer;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
MySQLQuery1: TMySQLQuery;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Buffer: PChar;
fd: Integer;
Stream: TMySQLBlobStream;
bmp:TBitmap;
flen:Int64;
begin
bmp:=TBitmap.Create;
try
//向Mysql表写入Bmp图像
bmp.LoadFromFile('c:\program files\common files\borland shared\Images\Splash\256color\factory.bmp');
MySQLQuery1.Open;
MySQLQuery1.Append;
MySQLQuery1.FieldByName('code').AsString:='刘志12';
MySQLQuery1.FieldbyName('image').Assign(bmp);
MySQLQuery1.TableName:='image';
MySQLQuery1.post;
//从Mysql表读出Bmp图像
MySQLQuery1.close;
MySQLQuery1.SQl.Clear;
MySQLQuery1.SQL.Add('select * from image where code="刘志12"');
MySQLQuery1.Open;
MySQLQuery1.Next;
MySQLQuery1.Edit;
Stream := TMySQLBlobStream.Create(MySQLQuery1.FieldByName('Image') as TBlobField, bmReadWrite);
bmp.LoadFromStream(stream);
canvas.Draw(0,0,bmp);
finally
Stream.Free;
bmp.Free;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
bmp:TBitmap;
stream:TMySQLBlobStream;
begin
end;
end.
#5
怎样设置?
#6
如何