asp.net:GridView中的关系数据库 [英] asp.net : relational databases in gridview

查看:74
本文介绍了asp.net:GridView中的关系数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在gridview中显示关系数据库的某些字段,表为:
tbl_User:UserId,UserName,LastName
tbl_Product:用户ID,产品ID,产品名称,价格
(PrimaryKey:UserId,ForiegnKey:ProductId)

我想在gridview中显示UserName,LastName,productName,Price ...

但是它不显示数据内容吗?

I want to show some field of relational database in gridview, tables are :
tbl_User :UserId,UserName,LastName
tbl_Product :UserId,productId, productName , Price
(PrimaryKey :UserId , ForiegnKey :ProductId)

and I wanna to show UserName,LastName,productName,Price in gridview ...

But it doesn''t show data content? what''s the wrong with that??

推荐答案

如果gridview没有显示任何结果,请使用调试器查看是否:

  • 结果来自数据库
  • 数据已正确绑定到网格视图
  • 存在/已创建必要的列,依此类推.
If the gridview isn''t showing any results, use the debugger to see if:

  • results are coming from the database
  • the data is correctly binded to the gridview
  • necessary columns exist/are created and so on.
select *
from tbl_user u, tbl_product p
where u.UserId = p.UserId


这篇关于asp.net:GridView中的关系数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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