下面是插入语句,
adoquery1.SQL.Text:='insert into tbltemp(image,name) VALUES (:photo,'''+edit1.text+''')'; // 进行插入操作
adoQuery1.Parameters.ParamByName('photo').LoadFromStream(Stream,ftBlob); // 读取保存的内存图
改成修改语句adoquery1.SQL.Add('update tbltempset id='''+edit1.text+'''');.......adoquery1.SQL.Add(',image='':photo''');
adoquery1.SQL.Add(' where [NO]='''+intNum+'''');
adoQuery1.Parameters.ParamByName('photo').LoadFromStream(Stream,ftBlob);
为什么总时出错:parameter 'ohoto' not found
adoquery1.SQL.Text:='insert into tbltemp(image,name) VALUES (:photo,'''+edit1.text+''')'; // 进行插入操作
adoQuery1.Parameters.ParamByName('photo').LoadFromStream(Stream,ftBlob); // 读取保存的内存图
改成修改语句adoquery1.SQL.Add('update tbltempset id='''+edit1.text+'''');.......adoquery1.SQL.Add(',image='':photo''');
adoquery1.SQL.Add(' where [NO]='''+intNum+'''');
adoQuery1.Parameters.ParamByName('photo').LoadFromStream(Stream,ftBlob);
为什么总时出错:parameter 'ohoto' not found
ADOQuery1.Parameters.CreateParameter()
var
intnum:string;
Stream:TMemoryStream;
begintry
Stream := TMemoryStream.Create; // 创建内存流Image1.Picture.Graphic.SaveToStream(Stream); // 将图片保存到内存流中
Stream.Position :=0;
intNum:=dbgrideh3.Fields[0].AsString;
adoquery3.Close;
adoquery3.SQL.Clear;
adoquery3.SQL.Add('update s_sales2 set name='''+combobox19.text+'''');
adoquery3.SQL.Add(',make='''+combobox34.text+'''');
adoquery3.SQL.Add(' where [NO]='''+intNum+'''');
ADOQuery3.Parameters.CreateParameter()
ADOQuery3.Parameters.ParamByName('photo').Assign(Image1.Picture.Bitmap);adoquery3.ExecSQL;
Stream.Free; // 释放内存流
finally
adoquery3.SQL.Clear;
adoquery3.sql.Add('select * from s_sales2');
adoquery3.open;
Panel3.Visible:=false;
showmessage('保存成功!');
end;
end;
你没事加个引号干嘛?那样,photo就成了一个字符常量了。