Html跨页面调用函数,一个cshtml如何在另一个cshtml中调用一个函数?

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值