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
Guest User
Tech Writer
357
120.8k
Data Retrieval from DB and Displaying...
Apr 16 2013 10:14 AM
Hello
Given the following code:-
protected void Button2_Click(object sender, EventArgs e)
{
var search = TextBox2.Text;
Database1Entities d = new Database1Entities();
var query = from s in d.Customers
where s.Customername == search
select s;
foreach (Customer c in query)
{
TextBox3.Text = c;
}
What I want to achieve is a search given a particular name.
The local search variable is being passed into a L2S Query, im then looping through the records in the DB and then trying to assign the result set\return values to TextBox3 however I get a casting\conversion error due to the fact Text is of type string and my return value is of type Customer? yet, the Customername column in my DB is of type string or more accurately nvarchar?
Regards
Steven
Reply
Answers (
2
)
Generating Invoices similar to tally ERP with Headers
Merging two pdf documents into one pdf using iTextSharp