예제 #1
0
        public string insertQuery(SaveQuery qs)
        {
            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("insert into SaveQuery (Query,DatabaseName,UserName,Query_Name) values ('" + qs.Query + "','" + qs.DatabaseName + "','" + qs.UserName + " ','" + qs.Query_Name + "')", con);
                cmd.ExecuteNonQuery();
                con.Close();

                return("success");
            }catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
예제 #2
0
        public List <SaveQuery> GetSave_Query(string UserName)

        {
            List <SaveQuery> qs = new List <SaveQuery>();

            con.Open();
            SqlCommand    cmd = new SqlCommand("select * from SaveQuery where UserName='******'", con);
            SqlDataReader sdr = cmd.ExecuteReader();

            while (sdr.Read())
            {
                SaveQuery s = new SaveQuery();
                s.Query        = sdr[1].ToString();
                s.DatabaseName = sdr[2].ToString();
                s.Query_Name   = sdr[4].ToString();
                qs.Add(s);
            }

            con.Close();
            return(qs);
        }