Posts

Donate

Converting Rows To Columns With DateTime Column In SQL Server

Good evening! An issue was brought up by a developer on how to convert rows of DateTime values into columns using MS Access DB with functionality similar to pivoting of MSSQL.The problem has an added complexity since specific portions of the DateTime will be extracted too. See original post here: Converting Columns to Rows in MS Access . The data presented is similar to a Timesheet entry wherein an employee has login/logout records. The solution presented in the thread involves usage of subquery and joins designed for MS Access Db. I modified the accepted answer to a T-SQL query using Group By, Max() function, Coalesce() and without subquery. SELECT LogInfo.fldMachineId, Year (LogInfo.fldLogDate) as [ Year ], Month (LogInfo.fldLogDate) as [ Month ], Day (LogInfo.fldLogDate) as [ Day ], Max (Coalesce( Convert ( varchar ( 5 ), T2.fldLogDate, 108 ), '' )) as TimeIn1, Max (Coalesce( Convert ( varchar ( 5 ), T3.fldLogDate, 108 ), '' )) as TimeOut1,

Could not load file or assembly Microsoft.VisualStudio.ConnectedServices Version=2.0.0.0

Image
Hello, This issue happens when closing applications created by Visual Studio 2015 either Console, Winforms or ASP.NET. The resolution for this problem is explained here in detail Visual Studio 2015 Enterprise with Update 1 - Could not load file or assembly Microsoft.VisualStudio.ConnectedServices, Version=2.0.0.0 . Be aware that the ConnectedServices page has several versions and you might install the current package which is incorrect. Since the assembly required is 2.0.0.0, the correct package is in this page Microsoft.VisualStudio.ConnectedServices 2.0.0 .

NuGet Package Manager Missing For Visual Studio 2015 Missing On Fresh Install

In the event that NuGet Package Manager Tool is not found on Visual Studio 2015 Update 1 after fresh install of the software, simply download the VSIX installer from Visual Studio MarketPlace and add it to the IDE. Here's the link of the NuGet Tool: NuGet Package Manager for Visual Studio 2015 . Cheers! :-)

Repeater Web Server Control In ASP.NET Web Forms With Bootstrap And Entity Framework

Image
Happy New Year! This post will illustrate on how to apply Bootstrap styling to a Repeater control given that the template used will be a Table element. To begin with, create an ASP.NET WebForm project. This application will retrieve Employee information from Northwinds database. Add an ADO.NET Entity Framework 6.0 to your project which will hook up with the Employee table. Add a WebForm page to your solution then drag a Repeater control inside the div tag below the form tag. Make sure to reference the bootstrap file in your head tag. The Repeater control will utilize the table element as it's template for displaying employee information. For the record, the employee photo will be shown on the left column, while the personal details are presented on the right column. The table also made use of Bootstrap's table css classes. <head runat= "server" > <title></title> <link href= "Content/bootstrap.css" rel= "stylesheet&q

ASP.NET MVC Multiple PagedList Pager In A Single View

Image
Good afternoon! In a situation wherein a single page will contain multiple paging such as displaying master-details records or similar requirements, using a couple or more PagedList pager will cause logical errors such as when you click on the paging of details record to traverse to the next page, the paging of master record will move to the next record as well. In order to solve this dilemma, we need to assign a specific page variable to a PagedList object to prevent this issue from happening. In this example, I'll demonstrate showing products information from AdventureWorks database whose stocks are above or below a certain reorder point. The page model class below has two page properties namely BelowReorderPage and AboveReorderPage . And these properties are assigned to their specific PagedList object whether ProductsBelowReorder or ProductsAboveReorder . PageModel.cs public class PageModel { public int BelowReorderPage { get ; set ; } public int AboveReorderPage {

DataList In ASP.NET MVC With Paging Using PagedList And Bootstrap

Image
Here's an example ASP.NET MVC application that shows information in a DataList layout with pagination using PagedList Pager. The project also integrates Bootstrap for enhancing the UI and display the images from AdventureWorks Products table through an ImageHandler class. The significant files used in this project are: 1. PagingModel.cs/IndexModel.cs - These classes are responsible for defining the page number, size of page, and PagedList property that stores the information that are paged accordingly to it's size. public class PagingModel { public PagingModel () { Size = 24 ; Page = 1 ; } public int Page { get ; set ; } public int Size { get ; set ; } } public class IndexModel { public PagingModel PageModel { get ; set ; } public IndexModel (PagingModel pageModel) { Products = new PagedList<ProductViewModel>( new List<ProductViewModel>(), 1 , pageModel.Size); PageModel = pageModel; } public IPagedList<ProductViewModel>

ASP.NET Web Forms GridView With Running Total Per Group Using JavaScript

Image
Basing from the post DataTable With Running Total Per Group which applies running total to a DataTable object, we can also achieve the same functionality through the front-end side by changing the structure of the GridView control given that this is an ASP.NET WebForm application. The snippet to set the control's data source is simple such as below: dt.Columns.AddRange( new DataColumn[ 5 ] { new DataColumn( "SrNo" , typeof ( int )), new DataColumn ( "PartyName" , typeof ( string )), new DataColumn ( "ItemName" , typeof ( string )), new DataColumn ( "ChqAmt" , typeof ( int )), new DataColumn ( "PartyCode" , typeof ( string ))}); dt.Rows.Add( 1 , "ABC Water Supply" , "Construction Service" , 400 , "ABC" ); dt.Rows.Add( 2 , "ABC Pump Services" , "Type 24 Engine Pump" , 150 , "ABC" ); dt.Rows.Add( 3 , "ABC Water Supply" , "12 Ft Wa

How To Compute DataTable With Running Total Per Group In C#

Image
Good Evening! There was a question raised by a developer if it's possible to compute the running total of a specific DataTable column per grouping or category. The solution is to mark the category as a flag variable that indicates the group to be calculated. The sample code below creates a DataTable object with fictitious information of hardware materials that belong to a particular group specifically PartyCode column. If a column belongs to that group, it will perform calculations. If not, reset the flag variable and total so as to perform new calculations. When computing totals for large number of records, make sure to sort the DataTable using it's category. DataTable dt = new DataTable(); dt.Columns.AddRange( new DataColumn[ 5 ] { new DataColumn( "SrNo" , typeof ( int )), new DataColumn ( "PartyName" , typeof ( string )), new DataColumn ( "ItemName" , typeof ( string )), new DataColumn ( "ChqAmt" , typeof ( int

HTTP Error 500.23 - Internal Server Error. An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. (ASP.NET MVC HttpHandler)

Good day! I was trying to apply integrate an Image HttpHandler that discourages leeching from one of my Web Forms project to ASP.NET MVC. This hack is found on ASP.NET 2.0 MVP Hacks site. Upon running the ASP.NET MVC project, an issue was thrown to the browser specifically "HTTP Error 500.23 - Internal Server Error. An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode." Upon investigating, I found out that handlers in WebForms are declared in <httpHandlers> under <system.web>. <system.web> <httpHandlers> <add verb= "*" path= "*.jpg" type= "Events.Web.Extensions.NoLeechImageHandler" /> <add verb= "*" path= "*.jpeg" type= "Events.Web.Extensions.NoLeechImageHandler" /> <add verb= "*" path= "*.gif" type= "Events.Web.Extensions.NoLeechImageHandler" /> <add verb= "*" path=

Hide ASP.NET Web Forms GridView BoundField Column With Value Accessible Through JavaScript

To hide a BoundField column but make it's value still accessible through JavaScript just set column's ItemStyle-CssClass and HeaderStyle-CssClass properties using CSS class with value display:none . CSS .hiddenColumn { display : none ; } ASPX <asp:BoundField DataField= "GroupCode" HeaderText= "Group Code" ItemStyle-CssClass= "hiddenColumn" HeaderStyle-CssClass= "hiddenColumn" />

Donate