p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# 2005 (http://p2p.wrox.com/forumdisplay.php?f=138)
-   -   How to Bind Data in DataGrid (http://p2p.wrox.com/showthread.php?t=51792)

akumarp2p December 20th, 2006 10:10 AM

How to Bind Data in DataGrid
 
Hi
I am using this code to bind datagrid in Desktop Application with C# 2005.but Grid does't show any record. help me now.

SqlDataAdapter da = new SqlDataAdapter("select vendorname from vendorview order by vendorname", conVendor);
    DataSet ds = new DataSet("Vendor");
    da.Fill(ds);
     dgVendor.DataSource = ds;
    dgVendor.DataMember = "Vendor";

Thanks and Regards
Kumar Ashish
9350789189

Sunnys December 27th, 2006 02:36 AM

hi
 just add line below dgVendor.DataBind(); if u r not using it

hope this will help u




angelboy December 30th, 2006 12:11 PM

hi
you shoud add the table name in the fill statement like this :

for example if your table name is "test"
you shoud type

da.fill(ds,"test");

kiani mehdi

best regards
kiani mehdi


All times are GMT -4. The time now is 07:18 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.