public void GenericDatabaseThrowsWhenAskedToDeriveParameters() { Database db = new GenericDatabase(@"server=(localdb)\v11.0;database=Northwind;Integrated Security=true", SqlClientFactory.Instance); DbCommand storedProcedure = db.GetStoredProcCommand("CustOrdersOrders"); db.DiscoverParameters(storedProcedure); }
public void GenericDatabaseThrowsWhenAskedToDeriveParameters() { Database db = new GenericDatabase(String.Format(@"server={0};database=Northwind;Integrated Security=true", ConfigurationManager.AppSettings["SqlServerDatabaseInstance"]), SqlClientFactory.Instance); DbCommand storedProcedure = db.GetStoredProcCommand("CustOrdersOrders"); db.DiscoverParameters(storedProcedure); }
public static Status Submit(int id, string leadin, string count, string newsitems, string highlightitems) { Status stat = new Status(); GenericDatabase db = new GenericDatabase(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString, DbProviderFactories.GetFactory("MySql.Data.MySqlClient")); DbCommand cmd = db.GetStoredProcCommand("ins_media"); DateTime dte = DateTime.Now; string name = ""; name = "BOD_News_" + GetWeekNumber(dte).ToString() + "_" + id.ToString() + "_" + dte.Year.ToString(); db.AddOutParameter(cmd, "ReturnCode", DbType.Int32, 8); db.AddOutParameter(cmd, "ErrorMessage", DbType.String, 500); db.AddOutParameter(cmd, "NewID", DbType.Int32, 8); db.AddInParameter(cmd, "InID", DbType.Int32, id); db.AddInParameter(cmd, "InName", DbType.String, name); db.AddInParameter(cmd, "InLeadin", DbType.String, leadin); db.AddInParameter(cmd, "InCount", DbType.String, count); db.AddInParameter(cmd, "InNewsItems", DbType.String, newsitems); db.AddInParameter(cmd, "InHighlightItems", DbType.String, highlightitems); db.ExecuteNonQuery(cmd); stat.ReturnCode = db.GetParameterValue(cmd, "ReturnCode") != null ? (Int32)db.GetParameterValue(cmd, "ReturnCode") : 0; stat.ErrorMessage = name + ".html"; stat.NewID = db.GetParameterValue(cmd, "NewID") != null?db.GetParameterValue(cmd, "NewID").ToString() : "0"; Entry item = new Entry(); item.Name = name; item.LeadIn = leadin; item.NewItems = newsitems; item.HighlightItems = highlightitems; item.Count = count; CreateHTML(item); return(stat); }
public void GenericDatabaseThrowsWhenAskedToDeriveParameters() { Database db = new GenericDatabase(@"server=(local)\SQLEXPRESS;database=Northwind;Integrated Security=true", SqlClientFactory.Instance); DbCommand storedProcedure = db.GetStoredProcCommand("CustOrdersOrders"); db.DiscoverParameters(storedProcedure); }