bnde是实例化Entity, proc_LogOn是登陆的存储过程
bnsde.proc_LogOn(username, HashPassword, ”这里会显示要输入第三个参数,应该输入什么?“);
存储过程如下:
ALTER PROCEDURE [dbo].[proc_LogOn] -- Add the parameters for the stored procedure here @username varchar(50), @password varchar(50), @result bit output -- 如果结果不为0则登录成功,否则登录失败ASif exists(select * from users where username=@username and password=@password) begin set @result = 1 -- 登录成功 endelse begin set @result = 0 -- 登录失败 end
求解~
1 回答
喵喔喔
TA贡献1735条经验 获得超5个赞
只要照着下面代码中的para3改为你的result1/2就可以了。
using (SEntities se = new SEntities())
{
EntityConnection entityConnection = (EntityConnection)se.Connection;
DbConnection storeConnection = entityConnection.StoreConnection;
storeConnection.Open();
DbCommand command = storeConnection.CreateCommand();
command.CommandText = "NameOfStoredProcedure";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("param1", value_of_param1));
command.Parameters.Add(new SqlParameter("param2", value_of_param2));
SqlParameter param3 = new SqlParameter();
pA.SqlDbType = SqlDbType.Bit;
pA.ParameterName = "@param3";
pA.Direction = ParameterDirection.Output;
command.Parameters.Add(param3);
command.ExecuteNonQuery();
returnValue = Convert.ToBoolean(param3.Value);
}
- 1 回答
- 0 关注
- 293 浏览
添加回答
举报
0/150
提交
取消