Esempio n. 1
0
        public void DSDBWrapperTransSqlNoCommitTestBug1857()
        {
            Database db = new GenericDatabase(@"server=(local)\SQLEXPRESS;database=Northwind;Integrated Security=true", SqlClientFactory.Instance);

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                using (DbTransaction transaction = connection.BeginTransaction())
                {
                    string    sqlCommand     = "select * from [Order Details]";
                    DbCommand dbCommand      = db.GetSqlStringCommand(sqlCommand);
                    DataSet   dsActualResult = db.ExecuteDataSet(dbCommand, transaction);
                }
            }
        }
        public void DSDBWrapperTransSqlNoCommitTestBug1857()
        {
            Database db = new GenericDatabase(@"server=(localdb)\v11.0;database=Northwind;Integrated Security=true", SqlClientFactory.Instance);

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                using (DbTransaction transaction = connection.BeginTransaction())
                {
                    string sqlCommand = "select * from [Order Details]";
                    DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);

                    DataSet dsActualResult = db.ExecuteDataSet(dbCommand, transaction);
                }
            }
        }
Esempio n. 3
0
        public void DSDBWrapperTransSqlNoCommitTestBug1857()
        {
            Database db = new GenericDatabase(String.Format(@"server={0};database=Northwind;Integrated Security=true", ConfigurationManager.AppSettings["SqlServerDatabaseInstance"]), SqlClientFactory.Instance);

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                using (DbTransaction transaction = connection.BeginTransaction())
                {
                    string    sqlCommand = "select * from [Order Details]";
                    DbCommand dbCommand  = db.GetSqlStringCommand(sqlCommand);

                    DataSet dsActualResult = db.ExecuteDataSet(dbCommand, transaction);
                }
            }
        }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(Request.QueryString["id"]))
        {
            newsid.Attributes["ref"] = Request.QueryString["id"];
            string          newsitem      = "<div class='subitem top10 newsitem'><div class='delete-item'>DELETE</div><div class='top10 itemtitle'>~name~</div><div class='formitem top10'><label for='newstitle'>News Title</label><input name='' class='newstitle' value='~title~' /></div><div class='formitem top10'><label for='newstitle'>News Source</label><input name='' class='newssource'  value='~source~' /></div><div class='formitem top10'><label for='newstitle'>News Date</label><input name='' class='newsdate'  value='~date~' /></div><div class='top10'>Story Content</div><textarea class='leadin rtf top10' id='~newsid~'>~content~</textarea></div>";
            string          highlightitem = "<div class='subitem top10 highlightitem'><div class='delete-item'>DELETE</div><div class='top10 itemtitle'>~name~</div><div class='formitem top10'><label for='highlighttitle'>Highlight Title</label><input name='' class='highlighttitle' value='~title~' /></div><div class='formitem top10'><label for='highlightlink'>Highlight Link: Please put the full URL in this field including the 'http://'</label><input name='' class='highlightlink' value='~source~' /></div></div>";
            Entry           item          = new Entry();
            DataTable       dtFB          = null;
            GenericDatabase db            = new GenericDatabase(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString, DbProviderFactories.GetFactory("MySql.Data.MySqlClient"));
            DbCommand       cmd           = db.GetSqlStringCommand("Select * from media where id ='" + Request.QueryString["id"] + "'");
            dtFB = db.ExecuteDataSet(cmd).Tables[0];
            cmd.Dispose();
            foreach (DataRow row in dtFB.Rows)
            {
                item.LeadIn         = row["leadin"].ToString();
                item.Count          = row["newscount"].ToString();
                item.NewItems       = row["newsitem"].ToString();
                item.HighlightItems = row["highlightitem"].ToString();
                newsid.InnerText    = row["name"].ToString();
            }
            leadin.Value = item.LeadIn;
            List <News> newitems = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <List <News> >(item.NewItems);
            string      tmp      = "";
            Int32       ctr      = 1;
            foreach (News x in newitems)
            {
                tmp += newsitem.Replace("~name~", "News " + ctr.ToString()).Replace("~title~", x.Title).Replace("~source~", x.Source).Replace("~date~", x.Date).Replace("~newsid~", "news" + ctr.ToString()).Replace("~content~", x.Content);
                ctr++;
            }
            news.InnerHtml = tmp;
            tmp            = "";
            List <Highlight> highitems = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <List <Highlight> >(item.HighlightItems);
            ctr = 1;
            foreach (Highlight x in highitems)
            {
                tmp += highlightitem.Replace("~name~", "Highlight  " + ctr.ToString()).Replace("~title~", x.Title).Replace("~source~", x.Source);
                ctr++;
            }
            highlights.InnerHtml = tmp;
            //leadin.Value = item.LeadIn;
            storycount.Value = item.Count;
        }
        DataTable       dtFBa = null;
        GenericDatabase dba   = new GenericDatabase(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString, DbProviderFactories.GetFactory("MySql.Data.MySqlClient"));
        DbCommand       cmda  = dba.GetSqlStringCommand("Select id, name from media order by id desc");

        dtFBa = dba.ExecuteDataSet(cmda).Tables[0];
        cmda.Dispose();
        ListItem mn = new ListItem();

        mn.Text  = "Select Saved Email Template";
        mn.Value = "0";
        ddmenu.Items.Add(mn);
        foreach (DataRow row in dtFBa.Rows)
        {
            mn       = new ListItem();
            mn.Text  = row["name"].ToString();
            mn.Value = row["id"].ToString();
            ddmenu.Items.Add(mn);
        }
    }