Programming

Recursive Object Properties

Recursive Object Properties I’ve been working to create a virtual file system for SQL databases and represent this in a web interface. While creating the classes in .NET I realised that I needed to be able to traverse all the ancestors of a file up to the root level and Read more…

By Shinigami, ago
Programming

SQL Stored Procedure in .NET Core

SQL stored procedure in .NET Core. I call SQL stored procedures slightly differently in .NET Core to the way I did in .NET framework as I now pass the connection string through as an argument and I need to remember to add the System.Data.SqlClient NuGet package. public static List<string> GetBlogSummaries(string Read more…

By Shinigami, ago
Programming

SqlDataReader Null Handling

SqlDataReader null handling When reading values from a SqlDataReader in .NET null SQL values will cause the reader to error. I used to have an explicit null check around each column, however as this involved quite a bit of code duplication I had a look for something better and found Read more…

By Shinigami, ago
Programming

Decimal to Hexadecimal in SQL

Conversion of decimals to hexadecimals in SQL While trying to convert some integers to hex values in SQL I found a few options that worked on ints and bigints but nothing that worked on anything larger and as I was needing to convert some integers of datatype decimal(20) I created Read more…

By Shinigami, ago
Programming

SQL Stored Procedure In .NET

I generally end up forgetting how to return results from a SQL stored procedure within .NET so I figured I’d put it here for reference. public static List<Blog> GetBlogSummaries() { List<Blog> blogs = new List<Blog>(); using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["BlogDatabase"].ConnectionString)) { using (SqlCommand command = new SqlCommand("sp__get_blog_summaries")) { command.CommandType Read more…

By Shinigami, ago