文件名称:关于水晶报表9中对图片的处理
文件大小:3KB
文件格式:TXT
更新时间:2009-03-15 02:52:39
控件 数据库相关 源码 资源
SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GOALTER proc sp_nrc_pattern_body /*this procedure is for the report ID:NRC002 Other procedure sp_uploadpicwithpath: upload the pictures to database */ ASdeclare @fname_in varchar(1000) ,@m_tbname varchar(50) --the name of the temporary table ,@sql varchar(8000) ,@fname varchar(1000) --catalogue and file name,the procedure need use ,@pattern_id_tmp intDECLARE @RC int , @rtncode int--get the size of the duct into filecreate table #pic (img image)create table #nrc_pattern_tmp ( nrc_pattern_id int, nrc_pattern_name nvarchar(30), nrc_pattern_desc nvarchar(60), nrc_pattern_path nvarchar(250), nrc_pattern_active_ind varchar(1), img image)insert into #nrc_pattern_tmp( nrc_pattern_id , nrc_pattern_name, nrc_pattern_desc, nrc_pattern_path, nrc_pattern_active_ind) select nrc_pattern_id , nrc_pattern_name, nrc_pattern_desc, nrc_pattern_path, nrc_pattern_active_ind from nrc_pattern where nrc_pattern_type=‘1‘ order by nrc_pattern_group_id,nrc_pattern_namedeclare cur_nrc_pattern cursor for select nrc_pattern_id,nrc_pattern_path from #nrc_pattern_tmp open cur_nrc_pattern fetch cur_nrc_pattern into @pattern_id_tmp, @fname while @@fetch_status = 0 begin --create the data process answer file set @m_tbname=‘[##temp‘+cast(newid() as varchar(40))+‘]‘ set @rtncode = 0 exec @rc = sp_uploadpicwithpath ‘#pic‘, @m_tbname, @fname,@rtncode output if @rtncode = 0 and @rc = ‘0 ‘ begin --duct the data into the formally table set @sql=‘update #nrc_pattern_tmp‘ +‘ set img=b.img‘ +‘ from #nrc_pattern_tmp a,‘ +@m_tbname +‘ b‘ +‘ where a.nrc_pattern_id =‘ + convert(char(4),@pattern_id_tmp) exec(@sql) --drop the temp table @m_tbname set @sql=‘drop table ‘+@m_tbname exec(@sql) end fetch cur_nrc_pattern into @pattern_id_tmp, @fname end close cur_nrc_pattern deallocate cur_nrc_pattern set @sql=‘select nrc_pattern_name , nrc_pattern_desc , nrc_pattern_active_ind, img from #nrc_pattern_tmp‘ exec(@sql) --set @sql=‘select nrc_pattern_path from NRC_PATTERN -- join p_test -- on nrc_pattern_path.pic=p_test.pic‘ -- exec(@sql) set @sql=‘drop table #pic‘ exec(@sql) set @sql=‘drop table #nrc_pattern_tmp‘ exec(@sql)GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO