P
piaoping
Unregistered / Unconfirmed
GUEST, unregistred user!
存储过程是这样写的<br>CREATE PROCEDURE dbo.pPCStyle3Add<br>(@StyleNo varchar(30),<br>@PO varchar(30),<br>@Memo varchar(50),<br>@PIC Image)<br>AS INSERT INTO dbo.tPCStyle<br> (StyleNo, PO, Memo)<br>VALUES (@StyleNo, @PO, @Memo)<br>Select 1 as ReturnValue<br>窗体1上的button的代码是<br>procedure TForm1.Button1Click(Sender: TObject);<br>vars<br> Strm:TmemoryStream;<br> JPG:TJPEGImage;<br> PicName:String;<br>begin<br> if OpenPictureDialog1.Execute then<br> begin <br> //读取图片,生成内存流<br> PicName:=UpperCase(ExtractFileName(OpenPictureDialog1.Files.Strings[0]));<br> JPG:=TJPEGImage.Create;<br> JPG.CompressionQuality := 30;//压缩率<br> JPG.Compress;<br> JPG.JPEGNeeded;<br> Strm:=TmemoryStream.Create ;<br> JPG.LoadFromFile(OpenPictureDialog1.Files.Strings[0]);<br> JPG.SaveToStream(Strm);<br> //调用存储过程,存储文字和图片 <br> With ADOStoredProc2 do<br> begin<br> parameters.ParamByName('@StyleNO').Value :=PicName;<br> parameters.ParamByName('@PO').Value :='edit1.Text;<br> parameters.ParamByName('@Memo').Value :=edit1.Text;<br> Parameters.ParamByName('@PIC').LoadFromStream(strm,ftblob);//有问题的句子<br> Prepared;<br> ExecProc ;<br> end ;<br> end;<br>end;<br>点击button1存储过程可以执行,但就是表dbo.tPCStyle其他字段插入数据正确,但image字段PIC中总是为空,也就是流不能被插入数据到数据中, 我觉得出问题的句子为Parameters.ParamByName('@PIC').LoadFromStream(strm,ftblob);请兄弟们帮忙指正呀