Arsip: kok stack overflow?????

 
user image
more 11 years ago

akudana

kenapa yaa kok error saya ingin membuka gamabar kemudian saya simpan gambar itu ke database.... dan bila dijalan kan program jalan tapi klau mau ke baris lain kemudian ganti foto akan keluar erorrr sperti ini "stack overflow"... apanya yaa??/ ini source code saya: unit FMemo; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DBXpress, FMTBcd, DB, DBClient, Provider, SqlExpr, DBCtrls, StdCtrls, Grids, DBGrids, ExtDlgs; type TFormMemo = class(TForm) SQLConnectionMySQL: TSQLConnection; SQLQuerypribadi: TSQLQuery; DataSetProviderPribadi: TDataSetProvider; ClientDataSetPribadi: TClientDataSet; DataSourcePribadi: TDataSource; DBGridPribadi: TDBGrid; Label1: TLabel; DBMemoKeterangan: TDBMemo; ButtonGantiFoto: TButton; DBImageFoto: TDBImage; OpenPictureDialog: TOpenPictureDialog; procedure ButtonGantiFotoClick(Sender: TObject); procedure ClientDataSetPribadiBeforePost(DataSet: TDataSet); private { Private declarations } public { Public declarations } end; var FormMemo: TFormMemo; implementation {$R *.dfm} procedure TFormMemo.ButtonGantiFotoClick(Sender: TObject); begin if ClientDataSetPribadi.State <> dsEdit then ClientDataSetPribadi.Edit; if OpenPictureDialog.Execute then DBImageFoto.Picture.LoadFromFile (OpenPictureDialog.FileName); end; procedure TFormMemo.ClientDataSetPribadiBeforePost(DataSet: TDataSet); begin ClientDataSetPribadi.ApplyUpdates(0); end; end. Mohon bantuannya??? dan supaya tidak stack overflow diapain yaa???
user image
more 11 years ago

heriy4nt0

ApplyUpdates seharusnya ditempatkan setelah terjadi Post, jadi kemungkinan program diatas looping terus menerus karena perintah ApplyUpdates memicu terus menerus Event BeforePost, coba tempatkan ApplyUpdates di event AftherPost.
user image
more 11 years ago

heriy4nt0

sorry double posting, sy lihat kembali kodenya, bukankah tidak diperlukan Event tersebut, jadi langsung aja dari buttongantifoto : var s:string s:=''; if OpenPictureDialog.Execute then s:=OpenPictureDialog.FileName; if fileexists(s) then begin if ClientDataSetPribadi.State <> dsEdit then ClientDataSetPribadi.Edit; DBImageFoto.Picture.LoadFromFile(s); ClientDataSetPribadi.Post; ClientDataSetPribadi.ApplyUpdates(); //penyimpanan optimistic ?? end;
user image
more 11 years ago

akudana

oyaaa, ternyata codingnya saya pindahkan di event AfterPost udah bisa kok.......... makasih yaaaa...
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com