Subscribe to Subscribers
Talk to Webmaster Tony John

Forums » .NET » .NET »

by using empcode can we get the ename automatically


Posted Date: 04 Mar 2008      Posted By:: swathi     Member Level: Gold    Member Rank: 0     Points: 2   Responses: 1



hi
i have entered empcode ,ename and deisgnation in database
suppose if i enter empcode automatically ename should be displayed in the textbox




Responses

#197827    Author: silpa      Member Level: Gold      Member Rank: 0     Date: 04/Mar/2008   Rating: 2 out of 52 out of 5     Points: 2

Hi

Suppose if you have a combo box with empcode values from the database.

Then you canwrite as
SqlConnection con = new SqlConnection("Give the connection string");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;//con is SqlConnection
con.Open();
SqlDataReader dr;

cmd.CommandText = "select ename from emp where empcode='+combobox1.text;
dr = cmd.ExecuteReader();
dr.Read();
TextBox1.Text=dr[0].ToString();



 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Same Error Plz how execute this querry
Previous : XML Details
Return to Discussion Forum
Post New Message
Category:

Related Messages
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.