.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 >> WPF >> Post New QuestionBookmark and Share Subscribe to Forum

text block

Posted By: siri.k     Posted Date: February 09, 2011    Points:2   Category :WPF
hai all can any one plz tell me ,, in my project design there is one button show customer id , and when we clik that button i want to display all customer details avail in database should be display in that text blok so plz tell me how to write code for that

Responses
Author: siri.k             
Posted Date: February 10, 2011     Points: 5   

no one is there to ans my que hmmmmmmmm

Author: Naresh             
Posted Date: February 15, 2011     Points: 5   

hi siri,

U cannot display all the customer id in a text box rather u can use data grid to display all the records,
Here i give the coding for displaying in datagrid,
Copy datagrid from tool box and place it in ur form
in button click event try this code,


SqlConnection con1 = new SqlConnection("Server=LocalHost;DataBase=DatabaseName;Uid=sa;Pwd=sa");
con1.Open();
SqlCommand cmd3 = new SqlCommand("select customerId from TableName", con1);
DataTable t = new DataTable();
SqlDataAdapter dr = new SqlDataAdapter(cmd3);
dr.Fill(t);
this.DataGrid1.DataSource = t;
this.DataGrid1.DataBind();
con1.close();


In think the code will help u




Thanks
Naresh
Author: siri.k             
Posted Date: February 16, 2011     Points: 5   

thanku naresh



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