[VS2010]使用LINQ to SQL Class發生CS0102: The type 'project.tCustomer' already contains a definition for 'emptyChangingEventArgs'

  • 4699
  • 0

摘要:[VS2010]使用LINQ to SQL Class發生CS0102: The type 'project.tCustomer' already contains a definition for 'emptyChangingEventArgs'

這兩天比較有空閒,就把之前去上課的範例拿出來重做一次
首先先建立好本機資料庫

新增一個LINQ to SQL Class
把Table拉進去,這樣就自動在Web.config建立了connection

 

1     <connectionStrings>
2         <add name="DbEOSConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DbEOS.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
3             providerName="System.Data.SqlClient" />
4     </connectionStrings>

然後new 一個page,在上面拉一個SqlDataSource,設定connection
再拉個chart control,設定好datasource跟欄位就可以跑了
不過一開始跑就出現這個錯誤

 

 

Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0102: The type '_20100210.App_Code.tCustomer' already contains a definition for 'emptyChangingEventArgs'

Source Error:

 

Line 79: 	{
Line 80: 		
Line 81: 		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
Line 82: 		
Line 83: 		private string _fId;
 

Source File: d:\WebApps\20100210\20100210\App_Code\DataClasses2.designer.cs    Line: 81 

納悶了許久,我只有用一個阿
後來看到有兩個dbml,因為我在玩所以弄了兩個出來
不過我有移出專案~~~

後來把不用的直接砍掉就可以正常運作了
這是我的認知不同的問題嗎 囧