(exception). DBML cannot be loaded into the LinqDataSource control, i.e. cannot be instantiated

Source: Internet
Author: User

Baidu's Problem

I have a file planetwrox.dbml in the App_Data folder, but I can't load it with LinqDataSource but I can't get it into the file. Such as..

The answer is not a good solution.

Address Http://zhidao.baidu.com/link?url=I_nCmdTEFTr8SD-12degXk-jkoPjZ2y72L_0LmZewhopCgMv-1nj6v3UsORYYw0U0fo4FPsTyWyk6H-PSP8Kp_

First Look at theASP. The use of Ling to SQL in net

Ling to SQL (used in. netframework3.5, vs2008 above)
Method:
1. Place the data sheet in the App_Data of the website.
2. Open SQLSERVER2005, append the data table in App_Data to SQLSERVER2005.
3. In visual studio2008, open the view---Server Explorer----data connection (right-click)---Add the connection, and then fill in the appropriate content.

4. Then right-click the Web site root, add a new item, select the Ling to SQL class, and then generate the. dbml class file.
5. If you want to manipulate the data table, drag the data table directly into the. dbml class file, and then right-click Save.
6, then in the CS file, first instantiate the data class, and then query judgment. (Note that when instantiating, the class name must be the same as the name of the. dbml class file, otherwise it cannot be instantiated)

Since the written function is to be called elsewhere, it is necessary to encapsulate the common writing in the function, which uses the Extract function, as follows:


Select the code that requires the constructor, then right-click, select Refactor, and then set the method name yourself, and the setting succeeds. The function is called where the function needs to be called.

Qinyuanchun www.qinychun.com 

Turn from

Http://www.cnblogs.com/fengzheng126/archive/2012/05/04/2483458.html

Workaround:

Change the name of DBML to the name of the table you need.

Note When instantiating, the class name must be the same as the name of the. dbml class file, or it cannot be instantiated

(exception). DBML cannot be loaded into the LinqDataSource control, i.e. cannot be instantiated

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.