bnde是實(shí)例化Entity, proc_LogOn是登陸的存儲過程
bnsde.proc_LogOn(username, HashPassword, ”這里會顯示要輸入第三個參數(shù),應(yīng)該輸入什么?“);
?
存儲過程如下:
ALTER PROCEDURE [dbo].[proc_LogOn] -- Add the parameters for the stored procedure here @username varchar(50), @password varchar(50), @result bit output -- 如果結(jié)果不為0則登錄成功,否則登錄失敗ASif exists(select * from users where username=@username and password=@password) begin set @result = 1 -- 登錄成功 endelse begin set @result = 0 -- 登錄失敗 end
?求解~
1 回答

喵喔喔
TA貢獻(xiàn)1735條經(jīng)驗(yàn) 獲得超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 關(guān)注
- 315 瀏覽
添加回答
舉報(bào)
0/150
提交
取消