Posts

Showing posts from 2020

Error on renaming database in SQL Server 2008 R2

Error on renaming database in SQL Server 2008 R2 use master ALTER DATABASE OldDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE     ALTER DATABASE  OldDatabaseName  MODIFY NAME = [New_DatabaseName] ALTER DATABASE  New_DatabaseName  SET MULTI_USER Notes:  you should use  WITH ROLLBACK IMMEDIATE  while altering a database that other users might be operating on, in order to ensure the integrity of these operations. But it is not really necessary when setting the database back to MULTI_USER mode again since the database is already at SINGLE_USER mode and you are the only user able to run any transactions anyway.

Convert Viewmodel to JSON string using C#, convert json string to JSON Format using C#

//CONVERT POST PARAMETERS INTO JSON-SERIALIZE var json = JsonConvert.SerializeObject(model); // Convert Json String to JSON Format in C# dynamic responseData = Newtonsoft.Json.Linq.JObject.Parse(_responseData);

Accessed JArray values with invalid key value. Array position index expected

Accessed JArray values with invalid key value: “fields”. Array position index expected  ========================================================== { "response" :{ "status" : "ok" , "userTier" : "approved" , "total" : 1 , "startIndex" : 1 , "pageSize" : 10 , "currentPage" : 1 , "pages" : 1 , "orderBy" : "newest" , "results" :[{ "id" : "sustainable-business/sustainable-finance-where-next-open-thread" , "sectionId" : "sustainable-business" , "sectionName" : "Guardian Sustainable Business" , "webPublicationDate" : "2014-02-13T13:27:00Z" , "webTitle" : "Where next for sustainable finance? - open thread" , "webUrl" : "http://www.theguardian.com/sustainable-busi...

The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine

Image

recovery pending in sql server

ALTER DATABASE [ DBName ] SET EMERGENCY ; GO ALTER DATABASE [ DBName ] set single_user GO DBCC CHECKDB ([ DBName ], REPAIR_ALLOW_DATA_LOSS ) WITH ALL_ERRORMSGS ; GO ALTER DATABASE [ DBName ] set multi_user GO For more info:  https://www.stellarinfo.com/blog/fix-sql-database-recovery-pending-state-issue/

convert string to MD5 hash C#

public static string MD5Hash ( string input ) { StringBuilder hash = new StringBuilder (); MD5CryptoServiceProvider md5provider = new MD5CryptoServiceProvider (); byte [] bytes = md5provider . ComputeHash ( new UTF8Encoding (). GetBytes ( input )); for ( int i = 0 ; i < bytes . Length ; i ++) { hash . Append ( bytes [ i ]. ToString ( "x2" )); } return hash . ToString (); }

Free Camtasia studio 9 Key

Camtasia studio 9 9RBCV-DY69D-C3XCC-HM2DL-ADADB

Line break in HTML with '\n'

<span style = " white-space : pre-line " > @Model.CommentText </span>

Sweet Alert Stuff Link

https://sweetalert2.github.io/

Add New column with foreign key using ms sql server

alter table [dbo].[Master_Tour] add PackageId int CONSTRAINT fk_master_tour_master_package FOREIGN KEY (PackageId) REFERENCES master_package(PackageId) 

Fill Drop down List Using VIew Model in MVC

=================== view model start =====================  public class TourMaster_SubCategoryViewModel     {         public int SubCategoryId { get; set; }         [Display(Name = "Category")]         [Required(ErrorMessage = "Please select category")]         public int CategoryId { get; set; };         public IEnumerable<TourMaster_CategoryViewModel> Categories { get; set; }         [Display(Name = "Sub category name")]         public string Name { get; set; }         [Display(Name = "Category name")]    } =================== view model end ===================== =================== CONTROLLER START (page load) =====================  public ActionResult subcategorydetails(int? vbgid)         {         ...

Fill Customize Drop down List in MVC

If you are using MVC Model to bind data, but you want to customize fill drop down . Use the below example =============================== @Html.DropDownListFor(x => x.PV, new List<SelectListItem> {       new SelectListItem() {Text = "10", Value="10"},       new SelectListItem() {Text = "20", Value="20"}, }, new { @class = "form-control", }) ===============================