標籤:etl manager conf [] c# user let current ora
public static Boolean getLmt(string lmtd_name) { string usr_user = HttpContext.Current.Session["MJERP10username"].ToString(); if (lmtd_name == "") { return true; } //string sql = @"select id from sys_lmtd where lmtd_mde||‘_‘||lmtd_name=‘" + lmtd_name + "‘ and lmtd_username=‘" + usr_user + "‘ union all select ro.id from role_mstr ro join usr_mstr on usr_role_id = ro.id where usr_user = ‘" + usr_user + "‘"; string sql1 = @"select id from sys_lmtd where lmtd_mde||‘_‘||lmtd_name=:lmtd_name and lmtd_username=:lmtd_username union all select ro.id from role_mstr ro join usr_mstr on usr_role_id = ro.id where usr_user =:usr_user"; OracleParameter[] param = new OracleParameter[]{ new OracleParameter(":lmtd_name",OracleType.VarChar,50), new OracleParameter(":lmtd_username",OracleType.VarChar,50), new OracleParameter(":usr_user",OracleType.VarChar,30) }; param[0].Value = lmtd_name; param[1].Value = usr_user; param[2].Value = usr_user; DataSet ds = new DataSet(); using (OracleConnection connection = new OracleConnection(ConfigurationManager.AppSettings["connString"])) { connection.Open(); OracleCommand cmd = new OracleCommand(sql1,connection); for (int i = 0; i < param.Length; i++) { cmd.Parameters.Add(param[i]); } OracleDataAdapter myda = new OracleDataAdapter(cmd); myda.Fill(ds); connection.Close(); } if (ds.Tables[0].Rows.Count > 0) { ds.Dispose(); return true; } else { ds.Dispose(); return false; } }
C# OracleParameter 執行增刪改查 執行個體