使用一个表的引用并从另一表获取数据

编程入门 行业动态 更新时间:2024-10-28 17:28:19
本文介绍了使用一个表的引用并从另一表获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨! 我有两个不同的表.临时的,生动的. 临时表包含所有在线的用户名.并且pictable包含所有已注册用户的图片. 现在我有一个index.aspx页面,其中包含gridview 我要的是在页面加载时检查模板,并为模板中存在的所有用户拍照并在gridview中显示它. 请告诉我该怎么做. 在此先感谢

Hi! i have two different tables. temptable, pictable. the temptable contains all those usersname whos are online. and pictable contains pictures of all the users who are registered. now i have an index.aspx page it contains gridview what i want is to when the page loads it checks the temptable and take pictures of all those users that are present in temptable and show it in gridview. please tell me how to do it. thanks in advance

推荐答案

temptable应该包含userid(主键),它是pictable中的引用键 例如 临时表: userid(主键) 用户名 图片: 用户ID(外键) 图片 然后添加gridview并分配具有查询的sqldatasource 选择t.username,p.image 从temptable t加入pictable p 在t.userid = p.userid temptable should contains userid (primary key) which is reference key in pictable for example temptable: userid (primary key) username pictable: userid(foreign key) image Then add gridview and assigned sqldatasource which has query Select t.username,p.image from temptable t join pictable p on t.userid=p.userid

更多推荐

使用一个表的引用并从另一表获取数据

本文发布于:2023-10-26 07:33:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1529494.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:并从   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!