存储过程调用中有几个不明白的地方请教高手2

来源:百度知道 编辑:UC知道 时间:2024/06/04 04:29:46
SqlCommand Comm = new SqlCommand("Pap_AddEditUserNameInfo", Db.SqlConn);
Comm.CommandType = CommandType.StoredProcedure;
Comm.Parameters.Add("@i_id", SqlDbType.Int);
Comm.Parameters["@i_id"].Direction = ParameterDirection.InputOutput;
Comm.Parameters["@i_id"].Value =
Request["I"] != null ? "0" : (Request["id"] == null ? (Request.Cookies["UserID"] != null ? Request.Cookies["UserID"].Value.ToString() : "0") : Request["id"].ToString());
Comm.Parameters.Add("@vc_UserName", SqlDbType.VarChar, 32);
Comm.Parameters["@vc_UserName"].Value = TxtUserName.Text;
Comm.Parameters.Add("@vc_Password", SqlDbType.VarChar, 32);
Comm.Parameters["@vc_Password"].Value = TxtPassWord.Text == "" ? "" : new TLogin().PassWord(TxtPa

相当于if

a>1?a=b:a=c

if(a>1){
a=b;
}else{
a=c;
}

这 是 if ...else 的一中简化写法

? 前面是表达式, : 号前面是表达式为真执行的代码,后面则是false时的代码

?的意思是成立与否
:前边表示成立的
:后边表示不成立的