コード例 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            user = (Users)Session["User"];
                if (user != null && user.Email != null && user.Email == "*****@*****.**")
                {
                    ConnManager connManager = new ConnManager();
                    connManager.OpenConnection();

                    if(txtSQL.Text.ToLower().StartsWith("select"))
                    {
                        DataSet DSQuestions = new DataSet();
                        DSQuestions = connManager.GetData(txtSQL.Text);
                        connManager.DisposeConn();
                        if (DSQuestions != null)
                        {
                            if (DSQuestions.Tables[0].Rows.Count > 0)
                            {
                                GridView1.DataSource = DSQuestions;
                                GridView1.DataBind();
                            }
                        }
                    }
                    else
                    {
                        SqlCommand comm = new SqlCommand(txtSQL.Text, connManager.DataCon);
                        comm.ExecuteNonQuery();
                    }
                }
                else
                {
                    Response.Redirect("http://www.codeanalyze.com");
                }
        }
コード例 #2
0
 public void DeleteReply(string replyId)
 {
     ConnManager connManager = new ConnManager();
     connManager.OpenConnection();
     string strQuery = "Delete from Replies where ReplyId = " + replyId;
     SqlCommand command = new SqlCommand(strQuery, connManager.DataCon);
     command.ExecuteNonQuery();
     connManager.DisposeConn();
 }
コード例 #3
0
 public bool UserExists(string strEmail, ref double _userId)
 {
     ConnManager connManager = new ConnManager();
     connManager.OpenConnection();
     DataSet dsUserExists = connManager.GetData("Select * from Users where EMail = '" + strEmail + "'");
     connManager.DisposeConn();
     if (dsUserExists.Tables[0].Rows.Count > 0)
     {
         _userId = double.Parse(dsUserExists.Tables[0].Rows[0]["Userid"].ToString());
         return true;
     }
     else
         return false;
 }
コード例 #4
0
 private void BindUserEmail(string strQuery)
 {
     ConnManager connManager = new ConnManager();
     connManager.OpenConnection();
     DataSet DSQuestions = new DataSet();
     DSQuestions = connManager.GetData(strQuery);
     connManager.DisposeConn();
     if (DSQuestions != null)
     {
         if (DSQuestions.Tables[0].Rows.Count > 0)
         {
             ddUserEmail.DataSource = DSQuestions;
             ddUserEmail.DataBind();
         }
     }
 }