首页 新闻 搜索 专区 学院

求更简洁的方案

0
悬赏园豆:10 [已关闭问题]
<P>需求为:&nbsp;</P> <P>标题&nbsp;&nbsp; 贡献人&nbsp; 修改&nbsp;<BR>内容描述&nbsp;<BR>相关文档下载 附件1说明&nbsp;&nbsp; 附件1下载&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 附件2说明&nbsp;&nbsp; 附件2下载&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 附件3说明&nbsp;&nbsp; 附件3下载&nbsp;<BR>审批: 未通过:&lt;修改意见&gt;                               通过&nbsp;</P> <P><BR>我想把这个附件下载做成一个用户控件 <BR>因为还有蛮其他功能都可以上传附件<BR>想关联的有六个表 <BR>他数据库是这样设计的<BR>CREATE TABLE snm_attachment(<BR>&nbsp;aid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER&nbsp;&nbsp;&nbsp;IDENTITY,<BR>&nbsp;subject&nbsp;&nbsp;&nbsp;VARCHAR(50)&nbsp;&nbsp;NOT NULL,<BR>&nbsp;description&nbsp;&nbsp;TEXT,<BR>&nbsp;url&nbsp;&nbsp;&nbsp;&nbsp;VARCHAR(255), -- 附件路径<BR>&nbsp;pubdate&nbsp;&nbsp;&nbsp;DATETIME, -- 发布时间(上传时间)<BR>&nbsp;sid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_计划编号<BR>&nbsp;pid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_项目编号<BR>&nbsp;tid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_任务编号<BR>&nbsp;eid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_经验编号<BR>&nbsp;cid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_评论编号<BR>&nbsp;fid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_流程编号<BR>&nbsp;<BR>&nbsp;PRIMARY KEY (aid),<BR>);<BR>GO</P> <P>我写了存储过程 <BR>create proc Proc_SelectattachmentByForeignID&nbsp; --根据各外键查询附件信息<BR>&nbsp;@keyID int, --1 为sid 计划编号2为pid项目编号3为tid 任务编号4为eid 经验编号5为cid 评论编号6为fid流程编号<BR>&nbsp;@sid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_计划编号<BR>&nbsp;@pid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_项目编号<BR>&nbsp;@tid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_任务编号<BR>&nbsp;@eid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_经验编号<BR>&nbsp;@cid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER, -- FK_评论编号<BR>&nbsp;@fid&nbsp;&nbsp;&nbsp;&nbsp;INTEGER -- FK_流程编号<BR>as<BR>&nbsp;if(@keyID=1)<BR>&nbsp;&nbsp;select aid,subject,description,url,pubdate,sid from snm_attachment where <A href="mailto:sid=@sid">sid=@sid</A><BR>&nbsp;if(@keyID=2)<BR>&nbsp;&nbsp;select aid,subject,description,url,pubdate,pid from snm_attachment where <A href="mailto:pid=@pid">pid=@pid</A><BR>&nbsp;if(@keyID=3)<BR>&nbsp;&nbsp;select aid,subject,description,url,pubdate,tid from snm_attachment where <A href="mailto:tid=@tid">tid=@tid</A><BR>&nbsp;if(@keyID=4)<BR>&nbsp;&nbsp;select aid,subject,description,url,pubdate,eid from snm_attachment where <A href="mailto:eid=@eid">eid=@eid</A><BR>&nbsp;if(@keyID=5)<BR>&nbsp;&nbsp;select aid,subject,description,url,pubdate,cid from snm_attachment where <A href="mailto:cid=@cid">cid=@cid</A><BR>&nbsp;if(@keyID=6)<BR>&nbsp;&nbsp;select aid,subject,description,url,pubdate,fid from snm_attachment where <A href="mailto:fid=@fid">fid=@fid</A><BR>go<BR>现在问题是 传入的参数太多了 <BR>那后面的六个ID 都是唯一的 我要么样做啊 ?<BR>&nbsp;有没有简洁点的解决方案啊?</P>
yeyang的主页 yeyang | 菜鸟二级 | 园豆:418
提问于:2008-04-02 11:06
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册