Tuesday

SQL Server Installation Fix: Repair a Failed SQL Server 2016 Installation

Introduction

SQL Server 2016 is a recently released version of Microsoft’s popular database platform that is developed with inbuilt advanced analytic and higher security technology. It targets all the critical applications and deeper insights in your data across on-premises and cloud. Here are few tips to handle the installation process to avoid the failure along with the method to repair the failed SQL Server 2016 Installation.

Scenarios when SQL server 2016 installation failed and need repair operation

  • When an instance of SQL Server got corrupted after successful installation and you need to repair that particular instance only.
  • When you need to repair a particular instance of SQL Server in case the upgrade operation is cancelled or failed after the instance name is mapped to the newly-upgraded instance.

If the following message appears in summary log, you need to repair the failed upgrade instance:

Error message: "SQL Server upgrade failed. To continue, investigate the reason for the failure, correct the problem, and then repair your installation."

In case the following message appears in the summary log, you need to uninstall and reinstall SQL Server, as you will not be able to repair the SQL Server instance.

Error Message:"SQL Server upgrade failed. To continue, investigate the reason for the failure, correct the problem."
When you repair an instance of SQL Server all the missing or corrupt files, registry keys are replaced with the new ones and all missing or invalid configuration values are set to their default values.
Note: Before initiating SQL Server failover clusters, remember that the repair process must be run on individual cluster nodes only. To repair a failover cluster node after a failed prepare operation, use Remove node and then continue performing the Prepare step again.
Repair steps when SQL Server installation get failed from the Installation Center
  1. Run the SQL Server Setup application (setup.exe) from SQL Server installation media.
  2. When you are done with prerequisites and system verification, you will be prompted to the Setup program that displays the SQL Server Installation Center page.
  3. Now, select Maintenance located in the left-hand navigation area, and click Repair to initiate the repair operation.
  4. The next window runs all the setup support rule and file routines to get assurance about all the prerequisites installed and then Setup validation rules. Now, select OK button or Install to continue.
  5. Now, on the Select Instance page, choose the instance you want to repair, and click ‘Next’ button.
  6. To validate the operation repair rules will run, click ‘Next’ to continue.
  7. The next page will be ‘Ready to Repair page’, which indicates that the operation is ready to proceed, click Repair.
  8. You will be able to view the status of the repair operation through Repair Progress page.

SQL Server Installation Fix
Steps to repair failed installation of SQL Server using Command Prompt

You can also run the given command at a command prompt to repair failed installation:
‘Setup.exe /q /ACTION=Repair /INSTANCENAME=instancename’

Summary

These are the manual steps you can use to repair a failed SQL server 2016 installation. But in case you are unable to repair SQL instances then you can always go with the alternate solutions available in the market. There are various SQL repair tools available that offer you advanced modules to repair SQL 2016 instances without following many steps.

Relevant Reading

Author Bio: Priyanka Chouhan is a technical writer in Stellar Data Recovery with 5 years of experience and has written several articles on SQL server & SharePoint. In the spare time, she loves reading and gardening.

Saturday

Csharp Example: Text to Speech

Introduction

Today, I am providing a working example of text to speech using .Net framework 4.5 with System.Text namespace. Text to speech is used widely in large scale for different purposes.
I am explaining all steps how to convert Text to Speech using C#, .Net framework.

Step 1. First of all, we have to add reference of System.Speech in our Text Speech application.

System.Speech

Step 2. Now import namespace using System.Speech.Synthesis in our form.
using System.Speech.Synthesis; 
Step 3. Now create object of SpeechSynthesizer
SpeechSynthesizer speech = new SpeechSynthesizer(); 
Step 4. Next one, write this line code speech.SpeakAsync(textBox1.Text) on button click.
speech.SpeakAsync(textBox1.Text); 
Step 5. Run application using F5 button to view Text speech interface.
Step 6. Enter sample text in input box to read through our application.
Step 7. Finally you can see how gracefully reading our text using our C# application.
Start Speech

Summary

Explained above, all steps Text to Speech using C# .Net framework 4.5 with working sample. I have attached working sample at the bottom of this article.
If anybody need help or further queries then write here.
Download

Video: Click here to Text to Speech Video Tutorial

Relevant Reading

Tuesday

MVC Caching: How to Disable Automatic Caching in ASP.Net MVC

Introduction

Today, I am explaining very important part of MVC application, just explaining about how to disable automatic caching in ASP.Net MVC application. It is very important in our MVC app while we don't allow end user to navigate browser cache (next, previous button etc.). MVC has provided feature to disable caching in ASP.Net MVC application.

Sunday

Count Down Timer: Jquery Timer Countdown in MVC Application

Introduction

Timer countdown is very important in our web apps while we are restricting to end user within specified time frame for example apps online Quiz, online survey etc. Here, in this article I am explain in full depth, how to implement Jquery/JavaScript timer count down in our web apps.

Step 1:First of all add following time to start count down while open our MVC web app, here I am adding 2 minutes of time count down.

public ActionResult Index()
{
  if (Session["Rem_Time"] == null)
  {
     Session["Rem_Time"] = DateTime.Now.AddMinutes(2).ToString("dd-MM-yyyy h:mm:ss tt");
   }
   ViewBag.Rem_Time = Session["Rem_Time"];

   ViewBag.Message = "Modify this template to jump-start your MVC application.";
   return View();
}
Step 2: Add following div in Index page of our MVC apps _layout.cshtml page.

id timecountdown

Step 3: Add following script in our MVC web app which will display time (hour, minutes, secs).

Interval Time Count Down

Populating JavaScript Timer Count Down in MVC Web Application

Finally, you can see how populating JavaScript Timer Count Down in MVC Web Application. I hope it will help you all. 
MVC Timer Count Down

Conclusion

I have explained fully with step to step, how we can implement Jquery timer count down in our MVC web apps. If any queries then let me know, I am very happy to reply all of your queries.

Download Complete Project

Download

Suggested Reading

Thursday

Dropdown List: Cascading Dropdown list in MVC

Introduction

Today, I am explaining about cascading drop down list in MVC, while we are working on CRM, ERP, Web Apps or other web apps then we often require to populate cascading dropdown list e.g. First populate Country then select country from list then corresponding state will be populated in other dropdown. This is the way that how we need cascading dropdown list in our MVC applications. Here I am taking example, first populating drop down list of classes, on the click of classes, the other drop down list will be populated of Subjects and then while we click on Subjects then chapter will be populated correspondingly.

Add Entity Framework Model in MVC Project

First of all, you have to add entities in our project to populate cascading drop down in our project. I am providing a video link (Add Entities) which explains all steps how to add entities in our project using entity framework.

namespace MvcApplication1.Context
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Infrastructure;
    
    public partial class MVC_AppEntities1 : DbContext
    {
        public MVC_AppEntities1()
            : base("name=MVC_AppEntities1")
        {
        }
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            throw new UnintentionalCodeFirstException();
        }
    
        public virtual DbSet tblChapterMasters { get; set; }
        public virtual DbSet tblClassMasters { get; set; }
        public virtual DbSet tblSubjectMasters { get; set; }
    }
}

Populate First Dropdown List (Subjects)

Here I have written an action method in controller as below:
[HttpGet]
public ActionResult My_MVC_App(string ddlClasses, string ddlSubjects, string ddlChapters)
{
    var _context = new MVC_AppEntities1();
    List _classlst = GetClasses();

   // Clases
   List li = new List();
   foreach (var item in _classlst)
   {
   li.Add(new SelectListItem { Text = item.ClassName, Value = item.ClassIDPK.ToString() });
   }
   ViewData["Classes"] = li;

   return View();
}

Populate Second Dropdown List (Subjects)

Next step is to write action method to populate second dropdown list of subject while we click on classes drop down list.
[HttpGet]
public JsonResult GetSubjectsNew(Int16 ClassID)
{
    List _lstSubjects = GetSubjectsID(ClassID);
    List _liSubj = new List();
    /// 
    var _context = new MVC_AppEntities1();
foreach (var _itemsubject in _lstSubjects)
{
  _liSubj.Add(new SelectListItem { Text = _itemsubject.SubjectName, Value = _itemsubject.SubjectIDPK.ToString() });
}

return Json(new SelectList(_liSubj, "Value", "Text"), JsonRequestBehavior.AllowGet);
  

Populate Third Dropdown List (Chapter)

Now next step is to populate third dropdown list of chapters while we click on subjects correspondingly.

 [HttpGet]
 public JsonResult GetChapterList(Int16 SubjectID, Int32? ChapterID)
{
   List _lstChapters = GetChapters(SubjectID);
   List _liSubj = new List();

   foreach (var _itemsubject in _lstChapters)
   {
     _liSubj.Add(new SelectListItem { Text = _itemsubject.ChapterName, Value = _itemsubject.ChapterIDPK.ToString() });
   }
   return Json(new SelectList(_liSubj, "Value", "Text"), JsonRequestBehavior.AllowGet);
}

Helping Method to Populate All Dropdowns (Classes, Subjects, Chapters)

Helping Methods

I have explained below three helping methods to populate all drop downs correspondingly.

MVC Razor View
Now I am talking about MVC razor view where we are playing with all three drop downs interface.

Import Jquery Library in our Project (Under Head Tag)


Head Tag

MVC Razor HTML Helpers

Below is written code to provide complete interface to populate three dropdowns.

razor view

Jquery Ajax call to MVC Controller

Here is written a Ajax/Jquery method to call Controller action for for subjects

Class Jquery Ajax Call

Here is written other Ajax/Jquery method to call Controller action for the chapters as below:

Chapter Jquery Ajax Call

Conclusion

Explained above about cascading dropdown in MVC with concerned every aspect of the MVC apps. Cascading dropdown is the common requirement of our each MVC applications, if we skip few steps to cascading drop down then sometimes it waste our very precious time of development.

Development Environment

Visual Studio 2013, Entity Framework 6.0, Database script under app folder App_Data, Change web.config settings according to your machine specific, Data source, Initial Catalog, Database User ID, Password etc.

Download Complete Project

Download

Relevant Reading