必须在Gridview中显示SupplierName而不是其代码 [英] have to show the supplierName instead of its Code in a Gridview

查看:74
本文介绍了必须在Gridview中显示SupplierName而不是其代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,
我的数据库Table.in下拉列表中有字段名称Suppliername&Inv_id,我正在显示名称,同时在表中保存时,我使用的是与Suppliername相关的Inv_id.
但是我必须在保存到数据库表中后在gridview中显示供应商名称....我只是得到ID而不是名称.
该怎么办?

请回复,
Aamir

Hi Friends,
i have field name suppliername & Inv_id in my Database Table.in dropdownlist i am showing the name and while saving in table i am using the Inv_id related to the Suppliername.
but i have to show the suppliername in gridview after saving in Database table....i am only getting the Id not name.
what can be done?

please reply,
Aamir

推荐答案

是的Aamir先生,您已经执行了正确的步骤,要绑定数据网格,必须从数据库中选择所有要绑定的字段.
而且,您还必须将字段的绑定属性赋予该Data gridview
Yes Mr. Aamir you have done the correct step, to bind a data grid you have to select all those fields from the database which you have to bind.
And You also have to give that binding properties of the field to that Data gridview


您好,您需要加入表才能检索SupplierName,

您可以使用带有内部联接的Select语句实现此目标

假设有两个表
1)SupplierMaster [with fileds]
i.Inv_id
ii. sName
iii. othersfields

2)帐单[with fileds]
一世. billno
ii.inv_id
iii.其他领域

--------------------
您的SQL select语句将如下所示

hi aamir, u need to JOin the tables in order to retrieve the supplierName,

u can achive this using Select Statement with Inner join

suppose there are two table
1) SupplierMaster [with fileds]
i.Inv_id
ii. sName
iii. othersfields

2) bill [with fileds]
i. billno
ii.inv_id
iii. other fields

--------------------
Your SQL select Statement will look like this

SELECT a.billno AS [Bill no], b.sName AS [Supplier] FROM bill AS a INNER JOIN SupplierMaster AS B on a.inv_id=b.inv_id



使用此查询绑定ur网格

并让我知道您是否找到了解决方法



use this query to bind ur grid

and let me know u found the solution or not


亲爱的朋友,
我在用于填充Gridview的存储过程以及现在可以正常使用的F9中进行了一些更改.

问候,
Aamir
dear friends,
i have made some changes in my Stored Procedure for Filling the Gridview and now its working F9.

Regards,
Aamir


这篇关于必须在Gridview中显示SupplierName而不是其代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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