Posts

Donate

Blazor Web App CRUD Project Using Visual Studio 2022, .NET 8 And Entity Framework Core

Image
Good day Team! Here's a basic Blazor Web App CRUD Project using Visual Studio 2022, .NET 8 and Entity Framework Core. The database for this project is SQL Server and the approach to communicate the database is database first. Let's begin. I. Project Setup 1. Open your SSMS editor and execute the create Employee table script that is used in this project into your SQL Server instance. This will be the datasource for our employee information. USE [ASPCoreTestDB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Employee]( [EmployeeID] [int] IDENTITY (1,1) NOT NULL , [EmployeeGovtID] [varchar](50) NULL , [EmployeeName] [varchar](200) NULL , [Age] [int] NULL , [Address] [nvarchar]( max ) NULL , [Salary] [decimal](18, 2) NULL , [Designation] [varchar](50) NULL , [HasDependents] [bit] NULL , CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED ( [EmployeeID] ASC ) WITH (PAD_INDEX = OFF , STATISTICS_NORECOMPUTE = OFF , IGNORE_DUP_K...

Add Menu Separator To Notepad++ Using The Notepad++ Plugin Pack In C#

Image
Hello, I'm currently adding modules to my Notepad++ plugin project and we noticed that the menu items are growing. So our architect suggested that it needs to be grouped and using a line separator for organization and proper grouping. At the moment, the menu itmes for the plugin isn't grouped based from the screenshot below. And here's the C# code to add the menu items. internal static void CommandMenuInit() { StringBuilder sbIniFilePath = new StringBuilder(Win32.MAX_PATH); Win32.SendMessage(PluginBase.nppData._nppHandle, ( uint )NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, sbIniFilePath); iniFilePath = sbIniFilePath.ToString(); if (!Directory.Exists(iniFilePath)) Directory.CreateDirectory(iniFilePath); iniFilePath = Path.Combine(iniFilePath, PluginName + ".ini" ); someSetting = (Win32.GetPrivateProfileInt( "SomeSection" , "SomeKey" , 0, iniFilePath) != 0); PluginBase.SetCommand(0, "Session Laws" , SessionLaws...

Recursive CTE Not Getting Top Level Superseded Parts In T-SQL

Image
Hello, I've been given a task to get the superseded partnumber of a certain part. The scenario is, the chain of the superseded is undetermined and could go as has high as four or more levels. See screenshot below of an example of product supersession. It illustrates that the part supersession of part M03971 is M32887 instead of its direct parent M04880. Trying out the concept of recursive CTE gets only the lowest level instead without it's parent part supersessions. WITH SupersededBy_Cte AS ( SELECT [StdDescID], [PartNumber], [SupersededBY], 0 AS [ level ] FROM [tblStdDesc] std1 WHERE std1.SupersededBY IS NULL UNION All SELECT std2.[StdDescID], std2.[PartNumber], std2.[SupersededBY], cte.[ level ] + 1 FROM SupersededBy_Cte cte INNER JOIN [tblStdDesc] std2 ON std2.SupersededBY = cte.StdDescID ) SELECT cte.[StdDescID], cte.[PartNumber], cte.[SupersededBY], cte.[ level ] FROM SupersededBy_Cte cte WH...

The EXECUTE Permission Was Denied On The Object - SQL Server Function

Image
Good day! I just recently restored a new database from the server and ran a script to create a T-SQL function. But when I called that function in C#.NET, it won't allow me to but instead returns a "The EXECUTE Permission Was Denied On The Object" error. To fix this issue, expand the database as to where the function was setup. Then click on the Security node -> Schemas -> dbo. When the Schema dialog opens, add the user name and set it's check the Grant checkbox of the Execute permission. After that, I can now successfully call the function from my .NET application. Cheers!

Font-Awesome Files Not Loading In Blazor Web Application In .NET 8

Image
Hello, As I was integrating the font-awesome library into Blazor Web Application, I noticed that the buttons were not showing the font-awesome icons. Upon checking through the browser console, the files such as fontawesome.css, regular.min.css and solid.min.css were not loaded even though they were referenced in App.razor component such as the code below. <head> <meta charset= "utf-8" /> <meta name= "viewport" content= "width=device-width, initial-scale=1.0" /> <base href= "/" /> <link rel= "stylesheet" href= "bootstrap/bootstrap.min.css" /> <link rel= "stylesheet" href= "app.css" /> <link rel= "icon" type= "image/png" href= "favicon.png" /> <link rel= "stylesheet" href= "~/lib/font-awesome/css/fontawesome.css" /> <link rel= "stylesheet" href= ...

Bootstrap 5 Intellisense Not Working In Blazor Web Application Using Visual Studio 2022

Image
Hello, For some reason, the intellisense feature of Visual Studio 2022 does not work when typing bootstrap classes into the class tag of an element. The solution that I basically worked is the same approach for ASP.NET Core MVC projects which is to enable the "Use legacy Razor Editor for ASP.NET Core. and then restart the Visual Studio IDE as shown on the pic below. Cheers!

Excel Interop Get Last Row Logic Conversion To ClosedXML

Hello, I was assigned to convert a VB.NET project that will generate an excel file using Excel COM interop into C# with ClosedXML as the tool to produce the report. When the project was finished coding and proceed to testing, the logic to get the last row isn't working and throws "Object Reference Not Set To An Instance" error. The VB.NET logic that I need to convert to ClosedXML is presented below. Private Function GetLastRow () As Int32 xlRange = xlWSheet.Range( "A65536" ).End(Excel.XlDirection.xlUp) GetLastRow = xlRange.Row() xlRange = Nothing End Function After reading the ClosedXML documentation and doing some debugging stuff, I successfully converted the Excel Interop function to ClosedXML counterpart. Below is the function that returns the last row used. All I need to do is to check first if last row used is null, then return row one. Otherwise, return the succeeding rows. private int GetLastRow (IXLWorksheet xlWSheet)...

Failed To Push To The Remote Repository See The Output Window For More Details

Image
Hello, I recently encountered an error when pushing some of my ASP.NET Core MVC project to github that says "Failed To Push To The Remote Repository See The Output Window For More Details" as shown on the image below. After checking the Output Window by selecting GitHub from the dropdown list, a more explicit error message appears which is " git: 'credential-manager-core' is not a git command. See 'git --help'. ". I immediately checked my Git version that appears to be Git-2.37.1-64-bit which is slightly behind the recent update Git-2.45.0-64-bit . Replacing the old Git software with the current one solved the issue. Cheers!

Donate