-
The Very Basic Syntax of Razor
If you have worked in ASP.NET MVC, you know that the default view engine (or templating engine) is Razor, much like the .aspx/.ascx/.master file templates in ASP.NET Web Forms. One thing I like about Razor is that you can use C# or VB.NET as the programming language to code in Razor. All you need to do is learn how to use the Razor syntax. So... Read More
-
New to Active Directory and need to use it in .NET?
Don’t worry, it’s easier than you think. AD Explorer If you haven’t seen what Active Directory (AD) looks like, you can use a free AD viewer application, like the AD Explorer. I would recommend downloading it because it’s a useful tool in navigating the tree structure of an AD and viewing the object properties or attributes that you want to ... Read More
-
SQL Server: Quickly run a command on each database. How?
Well it so happens that there is an undocumented stored procedure that you can use to do so and has been in SQL Server for some time now. This will definitely be handy if you are a software developer that does not like to code with cursor in SQL. I tested this in SQL Server 2008 R2 and the stored procedure is still there. Remind you that this... Read More
-
Is that a VB code or C#?
Ok, so the below code got me confused for a moment and I had to verify a couple of times if I am in the right language environment :). int myNumber = 1; string myString = myNumber as string; My initial question is, what’s the as keyword doing in a C# code? Is that a variable declaration like in VB? As it turned out, it’s another operator in ... Read More
-
Storing an Excel File in a SQL Server Database
If you have a table with an image data type field where you store an Excel file or any file for that matter, and you need to update a particular record with a new file, you can use OPENROWSET. UPDATE MyTable SET MyImageField = ( SELECT * FROM OPENROWSET(BULK N’C:\MyExcelFile.xls’, SINGLE_BLOB) AS MyFile ) FROM MyTable WHERE … On... Read More