如何编写程序以编辑具有ID的图像 [英] how to write procedure to editing Image with there ID

查看:92
本文介绍了如何编写程序以编辑具有ID的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ImageName,''_'',Id和.jpg保存图像
如图片名称= abc,图片编号= 49
然后将图像保存为abc_49.jpg
在编辑图片的情况下,我这样写

我写这样的程序

 开始
    
        更新 tblGallery 设置

        Caption =  @ Caption ,
        ImageName = @ Caption + '  _' +  @ GalleryID  + ' .jpg'
        其中 GalleryID =  @ GalleryID 

    结束

开始
    选择  @@身份更新 tblGallery 设置

        Caption =  @ Caption ,
        ImageName = @ Caption + '  _' +  @@ Identity  + ' .jpg'
        其中 GalleryID =  @ GalleryID 

    结束 



但是它不能正常工作吗?

解决方案

为什么要在上面的查询中添加分号?

试试:

 -  SQL过程代码的一部分
开始
        更新
           tbl图库
        设置
           Caption =  @ Caption ,
           ImageName = @ Caption + '  _' +  @ GalleryID  + ' .jpg'
        其中
           GalleryID =  @ GalleryID 
结束 



在此处查看详细信息:存储过程:参数,插入和更新 [ ^ ]


I am saving my image with ImageName,''_'',Id and .jpg
like Image name=abc,and Image Id=49
then image saved like abc_49.jpg
in case of editing image i am writing like that means

I write procedure like that

begin
    
        update tblGallery set

        Caption = @Caption,
        ImageName =@Caption+'_'+ @GalleryID +'.jpg'
        where GalleryID = @GalleryID

    end
and also like that
begin
    select @@Identity;
        update tblGallery set

        Caption = @Caption,
        ImageName =@Caption+'_'+ @@Identity +'.jpg'
        where GalleryID = @GalleryID

    end



but its not working can u suggest me how to do that.

解决方案

Why are you putting a semicolon in the query above?

Try:

--Part of the SQL Procedure code
begin
        update 
           tblGallery 
        set
           Caption = @Caption,
           ImageName =@Caption+'_'+ @GalleryID +'.jpg'
        where 
           GalleryID = @GalleryID
end



Have a look at details here: Stored Procedures: Parameters, Inserts and Updates[^]


这篇关于如何编写程序以编辑具有ID的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆