在webmatrix中,我在App_Data中创建了一个带有许多公共静态函数的DAL.cshtml。
我想从其他文件夹中的另一个.cshtml页面调用它们。
我现在得到了
编译器错误消息:CS0103:名称DAL在当前上下文中不存在
(请注意,我是一名初学者,关注将数据访问移至单个位置的博客)
在我的DAL.cshtml中有一个例子是:
public static void AddProfile (dynamic Profile)
{
var sql = "INSERT INTO profile (ProfileDescription, ProfileType) " +
"VALUES (@0, @1)";
PinwheelDB.Execute(sql, Profile.ProfileDescription, Profile.ProfileType);
var Profile.ProfileID = PinwheelDB.GetLastInsertId();
}在我的'调用'.cshtml中我有:
dynamic Profile = new ExpandoObject();
Profile.ProfileDescription = Request.Form["txtChildFirstName"];
Profile.ProfileType = 1;
functions.DAL.AddProfile(Profile);
var vProfileID = Profile.ProfileID;