使用存储过程使用entint框架进行编码 [英] Coding using entint framework using store procedure
本文介绍了使用存储过程使用entint框架进行编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友.......
我必须在数据库中提交数据。我使用实体框架进行编码..... >
我的编码是.....
Hi friends.......
I have to submit data in database.I did coding using entity framework.....
My coding is.....
efsampEntities a = new efsampEntities();
var x = new SqlParameter("@id", System.Data.SqlDbType.Int);
x.Value = Convert.ToInt32(TextBox1.Text);
var y = new SqlParameter("@sname", TextBox2.Text);
var z = new SqlParameter("@pass", TextBox3.Text);
a.ExecuteStoreCommand("insertemp @id,@sname,@pass", x, y, z);
这里insertemp是我的商店程序名称
我的编码无效。任何人都有关于这个的想法
here insertemp is my store procedure name
My coding is not working.Anyone have any idea about this
推荐答案
试试这个:
Try this:
efsampEntities db = new efsampEntities();
db.Database.SqlCommand("dbo.insertemp @id, @sname, @pass",
new SqlParameter("id", Convert.ToInt32(TextBox1.Text.Trim())),
new SqlParameter("sname", TextBox2.Text.Trim()),
new SqlParameter("pass", TextBox3.Text.Trim()));
--Amit
--Amit
这篇关于使用存储过程使用entint框架进行编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文