Tuesday 20 October 2015

ASP.NET MVC WebGrid Helper

ASP.NET MVC - Get the data from database and display as sort-able grid:

.cshtml page
@{
    var db = Database.Open("tutorial");   // db connection string
    var selectQueryString = "SELECT * FROM students ORDER BY id";   // sort by id by default
    var data = db.Query(selectQueryString);
    var grid = new WebGrid(data);
}

<div id="grid">
    @grid.GetHtml()
</div>


Web config database connection string:
<add name="tutorial" connectionString="Data Source=localhost;Initial Catalog=students;Integrated Security=true;" providerName="System.Data.SqlClient"/>


Tuesday 6 October 2015

Windows Service Start Failure

After adding the custom service to Windows service list, the service starts but after few seconds, it stops working.

Solution: Application MUST use the Release build rather than debug build.


Upgrade Windows 11 Home to Windows 11 Pro

Disable internet connection (Wi-Fi, Internet, etc.) Change the product key using the following Generic product key:                     VK7J...