当前位置: 首页>>代码示例>>C#>>正文


C# IDBManager.Close方法代码示例

本文整理汇总了C#中IDBManager.Close方法的典型用法代码示例。如果您正苦于以下问题:C# IDBManager.Close方法的具体用法?C# IDBManager.Close怎么用?C# IDBManager.Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDBManager的用法示例。


在下文中一共展示了IDBManager.Close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnlogin_Click

    protected void btnlogin_Click(object sender, EventArgs e)
    {
        int iRecordsFetched = 0;
        int iTempGroupID = 0;
        m_db = new DBManager(DataProvider.Oracle);

        if (m_db == null) {
            Response.Redirect("Error_page.aspx?ERROR=UNABLE_CREATE_DBOBJ");
        }

        ///''''''''''''If user clicked on login button check for username,password and selecttype are filled or not if they are not empty then proceed

        if (txtuser.Value.Length != 0 & txtpwd.Value.Length != 0) {
            m_db.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            m_db.Open();

            if (m_db.Connection == null) {
                ///''''''' If Failed to Eastablish database Connection Show Error Page to the User

                //  strstacktrace = HttpUtility.UrlEncode(m_db.Exception_str)
                strstacktrace = "";
                Response.Redirect("Error_page.aspx?ERROR=DATABASE_CONNECTION_FAILED&MESSAGE=" + strstacktrace);

            }

            ///''''''''''' Form the query to get the login userdetails from tbl_usermaster

            //     strQry = "select tbl_usermaster.userid,tbl_usermaster.usertypeflag,tbl_usermaster.webaccountflag,usersmemberslink.memberid,upper(username) as username,grp.groupid,grp.groupname from tbl_usermaster inner join  groupe as grp on tbl_usermaster.groupid=grp.groupid inner join usersmemberslink on tbl_usermaster.userid=usersmemberslink.userid where username='" & txtuser.Value.Trim() & "' and password='" & txtpwd.Value.Trim() & "'   and tbl_usermaster.activated=1 and tbl_usermaster.webaccountflag=1"
            //strQry = "select usermaster.userid,usermaster.usertypeflag,usermaster.webaccountflag,upper(username) as username,grp.groupid,grp.groupname from usermaster inner join  groupe as grp on usermaster.groupid=grp.groupid where username='" + txtuser.Value.Trim() + "' and password='" + txtpwd.Value.Trim() + "' and usermaster.activated=1 and usermaster.webaccountflag=1";
            //strQry = "select usermaster.userid,upper(username) as username from usermaster ";// where username='" + txtuser.Value.Trim() + "' and password='" + txtpwd.Value.Trim() + "'";
            strQry = string.Format("select users.userid,upper(username) as username,groupid from users where username='{0}' and userpassword='{1}'", txtuser.Value, txtpwd.Value);
            objDataset = m_db.ExecuteDataSet(CommandType.Text, strQry);

            if (objDataset == null) {
                m_db.Close();
                m_db.Dispose();
                // strstacktrace = HttpUtility.UrlEncode(m_db.Exception_str)
                Response.Redirect("Error_page.aspx?ERROR=RECORDSET_FETCH_FAILED&MESSAGE=" + strstacktrace);
            }

            ///'''''''''''''' get the no of records that exsist for the framed query

            iRecordsFetched = int.Parse(objDataset.Tables[0].Rows.Count.ToString());

            ///''''''''''''' if no records present give msg to the user alerting him that he is invalid user

            if (iRecordsFetched == 0) {

                txtuser.Focus();

            } else {
                ///'''''''''''' if records present get all the userdetails and store them inside a session

                CUSERDetails objUserDetails = new CUSERDetails();
                objUserDetails.iUserID = Convert.ToInt32(objDataset.Tables[0].Rows[0]["userid"].ToString());
                objUserDetails.strUserName = objDataset.Tables[0].Rows[0]["username"].ToString();
                objUserDetails.iGroupID = Convert.ToInt32(objDataset.Tables[0].Rows[0]["groupid"]);
                //objUserDetails.strGroupName = objDataset.Tables[0].Rows[0]["groupname"].ToString();
                objUserDetails.iMemberID = "1";
                //objDataset.Tables(0).Rows(0)("memberid").ToString()
                //objUserDetails.iRooterFlag = Convert.ToInt32(objDataset.Tables[0].Rows[0]["usertypeflag"]);
                //objUserDetails.iWebAccountFlag = Convert.ToInt32(objDataset.Tables[0].Rows[0]["webaccountflag"]);

                //objUserDetails.iUserID = CType(objDataset.Tables(0).Rows(0)("userid").ToString(), Integer)
                //objUserDetails.strUserName = objDataset.Tables(0).Rows(0)("username").ToString()
                //objUserDetails.iGroupID = 4 ' CType(objDataset.Tables(0).Rows(0)("groupid"), Integer)
                //objUserDetails.strGroupName = objDataset.Tables(0).Rows(0)("groupname").ToString()
                //objUserDetails.iMemberID = 1 'objDataset.Tables(0).Rows(0)("memberid").ToString()
                //objUserDetails.iRooterFlag = 1 'CType(objDataset.Tables(0).Rows(0)("usertypeflag"), Integer)
                //objUserDetails.iWebAccountFlag = 1 'CType(objDataset.Tables(0).Rows(0)("webaccountflag"), Integer)
                Session["sesuUserDetails"] = objUserDetails;

                objDataset.Dispose();
                // Free dataset
                m_db.Close();
                // Free SQL Connection

                iTempGroupID = objUserDetails.iGroupID;

                objUserDetails = null;
                m_db = null;

                //Response.Redirect("~/frmNewConnection.aspx");
               Response.Redirect("SBMUpload.aspx");

                }

            }
    }
开发者ID:riskypathak,项目名称:ENSERV,代码行数:90,代码来源:Login.aspx.cs


注:本文中的IDBManager.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。