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"); } }
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(); }
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; }
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(); } } }