Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster Tony John
Online Members
baskar
Pawan Awasthi
More...
Forums
»
.NET
»
LINQ
»
The type not mapped as a table
Posted Date:
12 Jul 2012
Posted By::
Pughaz
Member Level:
Silver
Member Rank:
1991
Points
: 5
Responses:
1
hi friend,
this is my code
string cnstr = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
cn = new SqlConnection(cnstr);
dc = new DataContext(cn);
Table<aprole> dt1 = dc.GetTable<aprole>();//Error The type 'aprole' is not mapped as a Table.
var role = from c in dt1 where c.rolename == "Reviewer" select c;
foreach (var dtvalue in role)
{
Response.Write("table" + dtvalue);
}
aprole is a class name ..
everything has fine, where i want to give the table name (in the database i have table name aprole)
i have to fetch data from that table only..
thanx advance
Tweet
Responses
#680078 Author:
Kapil
Member Level:
Gold
Member Rank:
51
Date: 12/Jul/2012 Rating:
Points
: 2
Hi,
I will suggest to use LINQ-To-SQL Class (DataContext) for the database and it will map your table (just one) which ever you want.
Below is the article
http://www.codeproject.com/Articles/22000/LINQ-to-SQL
Happy Coding
"Please don't forget to Rate this answer if you found it usefull"
http://www.dotnetspider.com/mentors/86-kapil-deo.aspx
My Blog
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
.
Tweet
Next :
Where to start Linq?
Previous :
Where and why we use LINQ
Return to Discussion Forum
Post New Message
Category:
Related Messages
Binding with repeater
From where to start? what is it LinQ?
Readind data from XML and copying to an array or object
Dynamic Query creation in Linq.
Avoid Looping
Follow us on Twitter:
https://twitter.com/dotnetspider
Active Members
Today
Pawan Awasthi
(13)
baskar
(7)
Swapneel
(6)
Last 7 Days
baskar
(298)
Asheej T K
(173)
Ultimaterengan
(167)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds