Posts

Donate

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!

How To Publish Visual Studio 2019 .NET Applications Or Projects To GitHub Using GitHub Extension

Image
Hello and Good day! Here's a step by step demonstration on how to upload or publish your C#, VB.NET or ASP.NET projects to Github using Visual Studio GitHub extension. Download and install the GitHub Extension for Visual Studio from the Visual Studio MarketPlace. After installing the GitHub Visual Studio Extension, navigate to the Team Explorer pane and click the Github Sign-in link. The default browser will launch the GitHub login page, that will require you to supply the username and password. When logged-in to Github, go back to your project, right click on the Project Solution and then click the Create GIT Repository . The Create a Git repository dialog will pop-up wherein you need to fill out the required information under the Create a new GitHub repository section. Once completed, click the Create and Push button. Go to your GitHub page and you may notice that the repository has been created along with the source code that's published. Cheers!

Visual Studio Error - This Emulator Does Not Have Hardware Acceleration Enabled In Xamarin And .NET MAUI

Image
Good day! After switching laptops and running some of my Xamarin Forms projects and simple .NET Maui applications, I encountered this error This Emulator Does Not Have Hardware Acceleration. Since this is a new laptop, I need to setup and enable the firmware virtualization and Hyper-V for Windows 10 operating system. First is I need to open the BIOS interface of the laptop and look for the Virtualization Technology under Security tab. By default, it's disabled Next is to enable it and then save changes. After modifying the BIOS settings for virtualization, you need to enable Hyper-V and Windows Hypervisor Platform checkboxes thru the Turn Windows Features On or Off application. Then restart your laptop or machine. Once I made those changes, I was able to run my applications using the Android emulator in Visual Studio. Cheers!

Visual Studio Code CSS Intellisense Not Working In CSS Files

Image
Hello, Lately, I was working on some CSS files that needs to be updated as per client request. It seems weird that the intellisense does not show it's dropdown of values for a specific style, as I remember this was working before. After doing some experiments and tests, here's the solution that worked for me in order for the CSS intellisense to work as expected on your Visual Studio Code editor. First is open settings tab using shortcut "Ctrl + ," or click the manage button at the bottom left of the editor. Expand the Text Editor menu and choose Files. Add items for *.css and css with values of css for each item. Once the steps are performed, this will resolve the CSS intellisense issue. Cheers!

Contoso University Application Written In ASP.NET Core MVC, Entity Framework Core And .NET 8

Image
Hello, Here's an upgrade of the Contoso University from .NET Core 3.1 to .NET 8. The only major change that I made was seeding the data to the database. The .NET Core 3.1 version used another class to initialize data and the logic was to loop through each the array variable and then add each array element to the DBContext object. After all array records have been added to the context object, call the context's SaveChanges() method. .NET Core 3.1 Seed Data Solution public static class DbInitializer { public static void Initialize(SchoolContext context) { //context.Database.EnsureCreated(); // Look for any students. if (context.Students.Any()) { return ; // DB has been seeded } var students = new Student[] { new Student { FirstMidName = "Carson" , LastName = "Alexander" , Enro...

Donate