在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;