Beispiel #1
0
        public string Showdata(showdata showdataform)
        {
            String          strSQL;
            MySqlConnection conn   = GetConnection();
            MySqlCommand    objCmd = new MySqlCommand();

            strSQL = "SELECT a.title,a.timeimage,b.username,b.id FROM savecs1 a Inner Join student b ON a.studentid=b.id";

            conn.Open();
            objCmd.Connection  = conn;
            objCmd.CommandText = strSQL;
            objCmd.CommandType = CommandType.Text;
            //MySqlDataReader reader = objCmd.ExecuteReader();
            objCmd.ExecuteReader();


            try
            {
                objCmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                throw e;
            }

            return(null);
        }
Beispiel #2
0
        //------------------//

        /*public void Addformteacher(Addfromteacher result)
         * {
         *
         *  String strSQL;
         *  MySqlConnection conn = GetConnection();
         *  MySqlCommand objCmd = new MySqlCommand();
         *
         *  strSQL = "INSERT INTO `Sendform`(`Name`,`Form`) VALUES" +
         *      " ('" + result.name + "','" + result.form + "'); ";
         *
         *  conn.Open();
         *  objCmd.Connection = conn;
         *  objCmd.CommandText = strSQL;
         *  objCmd.CommandType = CommandType.Text;
         *
         *  try
         *  {
         *      objCmd.ExecuteNonQuery();
         *
         *  }
         *  catch (Exception e)
         *  {
         *
         *      throw e;
         *  }
         *
         *  conn.Close();
         *
         * }*/

        public void Addcommemt(showdata result)
        {
            String          strSQL;
            MySqlConnection conn   = GetConnection();
            MySqlCommand    objCmd = new MySqlCommand();

            strSQL = "INSERT INTO `student` VALUES" + " ('" + result.comment + "''); ";

            conn.Open();
            objCmd.Connection  = conn;
            objCmd.CommandText = strSQL;
            objCmd.CommandType = CommandType.Text;

            try
            {
                objCmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                throw e;
            }

            conn.Close();
        }