بمب منطقی
جمعه 30 بهمن 1383, 01:37 صبح
اگه میشه منو راهنمایی کنید که کد زیر چه خطایی داره که پیغام خطای زیر رو بعد از کلیک بر روی Button9 منجر میشه.
در ضمن Pic و Stream به صورت Global تعریف شدن.
با تشکر از زحمات شما :flower:
procedure TForm2.SpeedButton1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
Pic:=TPicture.Create;
Stream:=TMemoryStream.Create;
Try
Pic.LoadFromFile(OpenDialog1.FileName);
Stream.LoadFromFile(OpenDialog1.FileName);
Image15.Picture:=Pic;
Finally
Pic.Free;
end;
end;
end;
procedure TForm2.Button9Click(Sender: TObject);
begin
ADOCommand1.Cancel;
ADOCommand1.CommandText:='INSERT INTO Main_Home_Unit(Melk_ID,Naghshe)'+
'VALUES('+Quotedstr(Edit1.Text)+',:BlobNaghshe)';
ADOCommand1.Parameters.ParamByName('BloabNaghshe') .LoadFromStream(Stream,ftBlob);
ADoCommand1.Execute;
Stream.Free;
end;
در ضمن Pic و Stream به صورت Global تعریف شدن.
با تشکر از زحمات شما :flower:
procedure TForm2.SpeedButton1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
Pic:=TPicture.Create;
Stream:=TMemoryStream.Create;
Try
Pic.LoadFromFile(OpenDialog1.FileName);
Stream.LoadFromFile(OpenDialog1.FileName);
Image15.Picture:=Pic;
Finally
Pic.Free;
end;
end;
end;
procedure TForm2.Button9Click(Sender: TObject);
begin
ADOCommand1.Cancel;
ADOCommand1.CommandText:='INSERT INTO Main_Home_Unit(Melk_ID,Naghshe)'+
'VALUES('+Quotedstr(Edit1.Text)+',:BlobNaghshe)';
ADOCommand1.Parameters.ParamByName('BloabNaghshe') .LoadFromStream(Stream,ftBlob);
ADoCommand1.Execute;
Stream.Free;
end;