Click here to Skip to main content
16,012,166 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 29-Jun-12 19:18pm
v2

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
 
Share this answer
 
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

SQL
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


use this query to bind ur grid

and let me know u found the solution or not
 
Share this answer
 
dear friends,
i have made some changes in my Stored Procedure for Filling the Gridview and now its working F9.

Regards,
Aamir
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900