TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Samio
NA
201
176.6k
LINQ to Entities - How to retrieve a data and use it as a variable in the whole project
Mar 21 2012 7:42 AM
Hi,
I have 1 WinForm and 2 tables:
- Form1 contains TextBox1
- Employee contains ID, LastName, FirstName, BirthDate.
- Tasks contains ID, TaskName
I need to input LastName and FirtName in TextBox1 to retrieve the related "TaskName" if exists,
then make the retrieved data usable from any location in the project
I need to know where to put the TaskName variable?
and how can I modify the next code to reach that purpose?
using (LINQtoEntitiesEntities MyEntities = new LINQtoEntitiesEntities())
{
ObjectQuery<Employee> Employee = MyEntities.Employee;
var query = (from p in Employee
where p.FirstName == TextBox1.Text.Trim()
select p.LasttName, p.FirstName);
}
Thanks
Reply
Answers (
3
)
LINQ to Entities Small code to test data retrieval C# WinForms
How do I Query Dynamically