.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Add datacoloum in c#.net Windows Application

Posted By: Vikramraj     Posted Date: March 18, 2010    Points:2   Category :C#
I have datagrid that is binded with database & I have to add One more column so how should i proceed?

Responses
Author: Syed Shakeer Hussain             
Posted Date: March 18, 2010     Points: 5   

Hi Vikramraj,

write the follwoing code in Load Event.
specify your column names in Select Command which columns you want in 'DataGrid'
SqlCommand cmd=new SqlCommand("select col1,col2,col3,col4 from tablename",conn);
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
da.Fill(ds,"tablename");
DataGrid.DataSource=ds.Tables["tablename"};




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend