Esempio n. 1
0
        public void GetBericht()
        {
            string bijdrageID = (String)System.Web.HttpContext.Current.Session["categorie"];

            using (DbConnection con = OracleClientFactory.Instance.CreateConnection())
            {
                if (con == null)
                {
                    //return "Error! No Connection";
                }
                con.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectieStr"].ConnectionString;
                con.Open();
                DbCommand com = OracleClientFactory.Instance.CreateCommand();
                if (com == null)
                {
                    //return "Error! No Command";
                }
                com.Connection  = con;
                com.CommandText = @"SELECT ""bijdrage_id"", ""titel"", ""inhoud"" FROM BERICHT WHERE ""titel"" IS NOT NULL";
                DbDataReader reader = com.ExecuteReader();
                try
                {
                    Bericht b;
                    Berichten.Clear();
                    while (reader.Read())
                    {
                        string titel;
                        try
                        {
                            titel = reader.GetString(1);
                        }
                        catch { titel = ""; }

                        b = new Bericht(reader.GetInt32(0), titel, reader.GetString(2));
                        Berichten.Add(b);
                    }
                }
                catch (NullReferenceException)
                {
                }
            }
        }
Esempio n. 2
0
        public void GetReacties()
        {
            Berichten.Clear();
            string bijdrageID = (String)System.Web.HttpContext.Current.Session["bijdrage"];

            using (DbConnection con = OracleClientFactory.Instance.CreateConnection())
            {
                if (con == null)
                {
                    //return "Error! No Connection";
                }
                con.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectieStr"].ConnectionString;
                con.Open();
                DbCommand com = OracleClientFactory.Instance.CreateCommand();
                if (com == null)
                {
                    //return "Error! No Command";
                }
                com.Connection  = con;
                com.CommandText = @"SELECT b.""inhoud"" FROM bijdrage bij, bericht b, bijdrage_bericht bb WHERE bij.id = bb.""bijdrage_id"" AND bb.""bericht_id"" = b.""bijdrage_id"" AND bij.id = " + bijdrageID;
                DbDataReader reader = com.ExecuteReader();
                try
                {
                    Bericht b;
                    Berichten.Clear();
                    while (reader.Read())
                    {
                        b = new Bericht(reader.GetString(0));
                        Reacties.Add(b);
                    }
                }
                catch (NullReferenceException)
                {
                }
            }
        }