W
wwwone
Unregistered / Unconfirmed
GUEST, unregistred user!
三层结构中怎样通过ClientDataSet把jpg,bmp文件保存到服务器端的SQL SERVER 数据库的一个字段中呢<br>procedure Tjlsz_form.BitBtn5Click(Sender: TObject);<br>var myfilestream: tfilestream;<br> myblob: tblobfield;<br>begin<br> try<br> with dm.ClientDataSet_Add do<br> begin<br> Close;<br> CommandText := '';<br> CommandText := 'select * from jpg';<br> open;<br> end;<br> OpenDialog1.Filter := '(*.*)|*.*';<br> if OpenDialog1.Execute then<br> begin<br> dm.ClientDataSet_Add.Append;<br> myfilestream := tfilestream.Create(OpenDialog1.filename, fmopenread);<br> myblob := tblobfield(dm.ClientDataSet_Add.FieldByName('jpg'));<br> myblob.LoadFromStream(myfilestream);<br> myfilestream.Free;<br> dm.ClientDataSet_Add.Post;<br> dm.ClientDataSet_Add.ApplyUpdates(0);<br> dm.ClientDataSet_Add.ApplyUpdates(0);<br> end;<br> showmessage('ok');<br> except<br> end;<br>end;<br>我这样做,但是保存不了数据,是什么原因呢,或用什么方法实现,最好出源码,谢谢大家