c#.net中数据表内的会话

时间:2018-02-06 06:50:48

标签: c# oracle

在下面的代码中,                     Session["FirstName"] = SCode.ToString();出错(当前上下文中名称session不存在)。谢谢

public DataTable Searchup(string SiteCode = "", string EmployeeRole = "")
{
        DbConnection conn = _dataFactory.CreateConnection();

        DbDataAdapter da = _dataFactory.CreateDataAdapter();

        DataTable dt = null;

        try

        {

            conn.ConnectionString = _connectionString;

            conn.Open();

            da.SelectCommand = conn.CreateCommand();

            da.SelectCommand.CommandType = CommandType.Text;

                 DbParameter param = null;

                     string sql = "SELECT ID,SITECODE,EMPLOYEEROLE,EMPLOYEEID, FROM " + _tblnpf + "User WHERE Empl <> 'Admin' ";

                   if (!String.IsNullOrEmpty(SiteCode.Trim()))

                 {

                      sql += "AND SiteCode = @SiteCode ";

                      OracleHelper.CreateParameter(ref da, ref param, "@SiteCode", DbType.String, ParameterDirection.Input, SiteCode);



                Session["FirstName"] = SCode.ToString();
                   }
                     da.SelectCommand.CommandText = OracleHelper.FixCommandText(sql);

                   DataTable dt1 = new DataTable("User");

                da.Fill(dt1);

0 个答案:

没有答案