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