sar*_* sh 6 c# asp.net .net-assembly
我使用visual studio 2010来设计网页,我使用了这个图层
编程,我使用gidview和objectdatasource,但我得到这个例外:
"The type 'WebApplication4.view1' is ambiguous: it could come from assembly
'C:\Users\EHSAN\AppData\Local\Temp\Temporary ASP.NET
Files\root\d04444bc\d654bde6\App_Code.i0fp6yrj.DLL' or from assembly
'C:\Users\EHSAN\Documents\Visual Studio
2010\Projects\WebApplication4\WebApplication4\bin\WebApplication4.DLL'. Please
specify the assembly explicitly in the type name."
Run Code Online (Sandbox Code Playgroud)
我把我的代码放在这里:
这是我的web.aspx:
<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="WebApplication4.view1"
SelectMethod="Search" OldValuesParameterFormatString="original_{0}" >
</asp:ObjectDataSource>
Run Code Online (Sandbox Code Playgroud)
这是APP_Code中BAL文件夹中的search.cs文件:
namespace WebApplication4
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Data;
public class view1 : System.Web.UI.Page
{
public view1()
{ }
public List<person> Search()
{
List<person> persons = new List<person>();
DataSet ds = PersonsDB.Search();
foreach (DataRow row in ds.Tables[0].Rows)
{
persons.Add(new person((String)row["id"], (String)row["nam"], (String)row["family"], (String)row["namepedar"], (String)row["shshenas"], (String)row["codemelli"]));
}
return persons;
}
}
Run Code Online (Sandbox Code Playgroud)
问题出在哪儿?
当项目中有两个同名的类时,就会发生这种情况,通常是由于复制和粘贴错误造成的。你能检查一下你是否还有其他命名的类吗view1?
如果这不是问题,请尝试清除临时 Web 文件,如下所示: 清除临时 asp.net 文件
| 归档时间: |
|
| 查看次数: |
10902 次 |
| 最近记录: |