使用n层体系结构中的实体框架插入数据库 [英] Insertion into database using entity framework in n-tier architecture

查看:67
本文介绍了使用n层体系结构中的实体框架插入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.....

我在may表中有3列。 Id主键和身份键,状态默认值为false,反馈。



我只想在n层arct中使用实体框架的反馈中插入值。



首先,我制作了Bo类,例如private int id; pubic int id {get,set}

现在我用DAL类创建函数(ENAme context = new Ename)

Tablename tt = new Tablename

context.addtotalename(tt)

context.savechanges();



现在我做了BAL类whaere我调用了DAL函数。在mu aspx.cs页面,我点击按钮确实工作



Bo aa = new BO();

aa.feedback = Textbox1.text;

bal ss = new bal();

ss.insert(aa)











我的错误是无法将空值插入''feedback''。

解决方案



首先编写反馈的硬代码值。如果这对你有用。这意味着你没有得到反馈的价值



谢谢


传递所有不可空的值这里简单

Hi.....
I have 3 column in may table. Id primary key and identity key,status default value false,feedback.

I want insert value only in feedback using entity framework in n-tier arct.

First of all i made Bo class such as private int id; pubic int id{get,set}
Now I made DAL class where I made function using(ENAme context=new Ename)
Tablename tt=new Tablename
context.addtotalename(tt)
context.savechanges();

Now I made BAL class whaere I call DAL function.In mu aspx.cs page I did work on click on button

Bo aa=new BO();
aa.feedback=Textbox1.text;
bal ss=new bal();
ss.insert(aa)





My error is that cannot insert the null into ''feedback''.

解决方案

Hi ,
First you write the hard code value for feedback . if this will work for you . its means you did not get the value of feedback

Thanks


pass all values which are not nullable simple here


这篇关于使用n层体系结构中的实体框架插入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆