第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

怎么用ASP.NET MVC用Entity調(diào)用帶有返回值的存儲過程?

怎么用ASP.NET MVC用Entity調(diào)用帶有返回值的存儲過程?

子衿沉夜 2018-12-06 11:14:37
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);
}
查看完整回答
反對 回復(fù) 2019-01-21
  • 1 回答
  • 0 關(guān)注
  • 315 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號