Posts

Convert Numeric Value Into Words (Currency) In C#

+++++++++++++++++++++++++ https://code.msdn.microsoft.com/windowsdesktop/Convert-Numeric-Value-Into-db70224e +++++++++++++++++++++++++ also good article for interview or learning deep about asp.net web forms +++++++++++++++++++++++++ https://www.c-sharpcorner.com/UploadFile/1492b1/C-Sharp-and-Asp-Net-question-and-answersall-in-one/ +++++++++++++++++++++++++

What event handlers can I include in Global.asax?

What event handlers can I include in Global.asax? Application_Start, Application_End,  Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed,  Application_EndRequest,  Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,  Application_PreSendRequestContent, Application_PreSendRequestHeaders,  Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache, Session_Start  and Session_End.

Insert and Get value multi checkbox box list using MVC 5

Insert and Get value multi checkbox box list using MVC 5 [HTTPGET] =========================  [HttpGet]         public ActionResult UserProfile()     // Show form data page load time         {             ProfileViewModel obj = new ProfileViewModel();             string username = Convert.ToString(Session["Username"]);             SignUp objsignup = db.signUp.Where(x => x.Username == username).FirstOrDefault();  List<Hobbies> objSelectedHobbies = FillHobbies();             if (!string.IsNullOrEmpty(objsignup.Hobbies))             {                             string s = objsignup.Hobbies;                 string[] values = s.Split(','); ...

When should we use a unique key

Image
SQL UNIQUE Constraint The UNIQUE constraint ensures that all values in a column are different. Both the UNIQUE and PRIMARY KEY constraints provide a guarantee for uniqueness for a column or set of columns. A PRIMARY KEY constraint automatically has a UNIQUE constraint. However, you can have many UNIQUE constraints per table, but only one PRIMARY KEY constraint per table. ======================== Q and A Question :  Since primary key and unique is similar. I have trouble grasping the concept of the two. I know primary key doesnt accept null and unique key accepts a null once. Since a null value is a unique value so it can be only accepted once. But the idea of primary key is having a uniqueness in every row. which a unique key also do. thats why im asking when is it proper to use primary key over unique key and vice versa. Answer :  A UNIQUE constraint is similar to PRIMARY key, but you can have more than one UNIQUE constraint per table. When you declare ...

Get Top 3rd salary using MS SQL server

You can get any number of Top salary by using below query WITH CTE AS (     SELECT EmpID, EmpName, EmpSalary,            RN = ROW_NUMBER() OVER (ORDER BY EmpSalary DESC)     FROM dbo.Salary ) SELECT EmpID, EmpName, EmpSalary FROM CTE WHERE RN =  @NthRow If somebody ask for Top 3rd salary, then i'll replace 3 to  @NthRow  then i'll execute query. and then i'll get top 3rd salary.   

Change database schema name using mssql

Question : ============================================ I have this schema :  [hhh].[spemployee] and what to change schema like this :  [eee].[ spemployee ] ============================================ Answer : ============================================= First Create below  IF (NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'eee'))  BEGIN     EXEC ('CREATE SCHEMA [eee] AUTHORIZATION [dbo]') END Then user ALTER to change schema name  ALTER SCHEMA [ eee ]      TRANSFER [hhh].[ spemployee ] ============================================= ===================================================== and Result as below :  [eee].[ spemployee ] =====================================================

Improve Performance of C# Code

Image
Improve Performance of C# Code This article helps you to know about the best coding practices that are used while coding using  C#  language. When we deliver code the created code should follow some standard which will improve optimization, readability, and quicker action on code that also improves the security aspects of code. Pascal Casing First characters of all words are Upper Case and other characters are lower case. Camel Casing   First characters of all words, except the first word are Upper Case and other characters are lower case. Check for 'null' Where ever there is possible for Null occurrence, make an explicit null check, this avoid the execution error. Remove Unused Using’s Using statement will load all the assemblies, so it’s better to remove unwanted assembly namespace reference in the codes. Indentation and Spacing It is recommended to use TAB space than a white space and this helps for better cod...