Latest Posts
Friday, December 10, 2021
Tuesday, November 23, 2021
Here are the steps:
1. Go to https://www.mongodb.com/download-center/community, then click on the "Download" button
Tuesday, November 16, 2021
One of the first thing you want to do is to connect to MongoDB so that you can run more commands.
Here is the command to connect to MongoDB
mongo --host=localhost --port=27017
All you need is the name of the host and port number, 27017 is the default port number and since we running the command on the MongoDB host, the host is localhost
Tuesday, August 3, 2021
In the last post we created our ACME Bank database in MySQL, the next step is to get the values from the Values table in the Asp.Net Core WebApi controller.
Let's create some test data so that we could retrieve the values from the database. The Values table could contain anything. So I am going to store famous philosophers throughout history. These philosophers are so famous that they only have one name:
You can run the SQL insert statement below to seed the data in MySQL:
INSERT INTO acmebank.Values (
Name
)
VALUES
(
'Socrate'
),
(
'Plato'
),
(
'Spock'
),
(
'Thanos'
);
So your Values table should look like this when you executed the insert query
Thursday, July 29, 2021
In this post we are going to create our first Entity Framework migration and creating an actual database in MySQL.
In order to do that we need to add a few NuGet packages to our Asp.Net Core project including the Entity Framework Core package. But, before we do that we want to find out what what version of .NET Core we are running. Obviously I have it memorized, but for the rest of you, you can type the command dotnet --version to figure out what the version is :) It's always a good idea to try and match the package version with the .NET Core runtime you have. It's one of the more annoying thing with Angular and Asp.Net Core, it's changing constantly. So as you can see my version 3.1.xxx so I should try to install packages that are made for 3.1.x.
The first package we are going to install is the Microsoft.EntityFrameworkCore. So open the ACMEBank.API project with Visual Studio Code. Press Ctrl+Shift+P and type NuGet and select
Tuesday, July 20, 2021
In this post we are going to install MySQL Workbench on Fedora. MySQL Workbench is a great GUI database management tool for MySQL. Even though we can do everything we need with MySQL on the terminal it's nice sometime to see the tables and data visually.
Here are the steps to install MySQL Workbench:
1, Go to the yum repository for MySQL at https://dev.mysql.com/downloads/repo/yum/ select the Fedora repository, and click "Download"
Tuesday, July 13, 2021
In this post we are going to circle back to MySQL and continue setting up our MySQL database, so that we can use it in our application. Since we don't want to use our root for log in and we turned off root login for remote connection. We have to create a dedicated user for our application. Here are the steps to create a dedicated dev use in MySQL
1. Log into MySQL with root using this command mysql -u root -p
2. In the MySQL prompt type CREATE User 'devuser'@'localhost' IDENTIFIED BY 'P@ssw0rd'; to create the user, obviously if this is your production environment you would want to use a more secure password
3. Then type GRANT ALL PRIVILEGES ON *.* TO 'devuser'@'localhost' WITH GRANT OPTION; to grant the user all the privileges on all the objects
4. Now type FLUSH PRIVILEGES; to update and apply the privileges
Tuesday, June 22, 2021
The most important thing for most modern dynamic application these day is choosing a database to store your data. If you are on a Windows environment then you use SQL Server database that is a fine choice. But if you are on Linux MySQL is a great choice also. In this post we are going to go through how to install MySQL server on our Fedora development machine.
Here are the steps to install MySQL on Fedora Linux:
1. First we need to add the MySQL repository to our machine by tying in the following command in the terminal
sudo dnf -y install https://dev.mysql.com/get/mysql80-community-release-fc32-1.noarch
Sunday, June 6, 2021
Here are the steps:
- Create a folder call /data/ then create another folder call db underneath it with the mkdir command, I've already created the folder so I can't do it on the command prompt again.
Saturday, May 29, 2021
Anyways here is how you add a dba to SQL Server 2014 on a Windows 8 machine.
1. Connect to your instance of SQL Server, then expand the "Logins" node
Friday, May 28, 2021
AdventureWorks Database Download
2. Click on the "Download" button on page
Tuesday, May 25, 2021
SELECT *FROM ProductsWHERE SupplierID NOT IN (1,2)
The above example all the products will be retrieved except for products with SupplierID of 1 or 2, here are the results
SELECT *FROM ProductsWHERE SupplierID IN (1,2)
In the above example all the products with the SupplierID of 1 or 2 are retrieved.
Monday, August 5, 2019
Thursday, December 13, 2018
Monday, August 8, 2016
Here are the steps to create your NorthwindCafe database:
1. Open the Startup.cs file, then type the following lines in the ConfigureServices method
var connectionString = Configuration["Data:NorthwindContextConnection"];
services.AddDbContext<NorthwindContext>(options => options.UseSqlServer(connectionString));
The line above gets the connection string from the appSettings.json file that we've created earlier. Then use the AddDbContext method in the services instance. Dependency injection will take care of the plumbing for you. Using lamba expression we tell the Entity Framework to use the Sql Sever provider for Entity Framework core.
Make sure you have the following namespaces in your Startup class
using NorthwindCafe.Web.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
Friday, August 5, 2016
Here are the steps:
1. Open the project.json file
Wednesday, August 3, 2016
Sunday, June 19, 2016
SELECT CategoryID,ProductName,UnitPriceFROM ProductsWHERE CategoryID = 1 OR CategoryID =2 AND UnitPrice < 15
When you run the query above you would expect that all the records retrieved will have a unit price of less than $15 dollar but that is not the case. Below is the result from the query.
Saturday, June 18, 2016
Step-by-Step Instructions:
1. First we need to add the Entity Framework 6.1.3 to our ASP.NET MVC, we accomplish by right-click on "References" then select "Manage NuGet Packages"










