Here are some handy code snippets for inserting a table into a Word document through a Task Pane Add-In. If you don’t know what that is, you can get up and running with this hello world example.
I demonstrate inserting at the selection, inserting at a named binding and inserting HTML. There is another way, you can insert raw Office Open XML (OOXML), and while that provides the most power and flexibility, it is also by far the most complex way to do it. Continue reading
I recently had the need to execute a .jar file from within an Azure WebJob built with C#. I found a few resources that showed how to upload a .zip file, for instance, and have that run a .bat file as a job. Or, how to create a Java web app. But my webjob needed to do more than just run a .jar, and I didn’t have the time to get up to speed on Java and the Azure Storage SDK for Java. As the Google let me down, here I demonstrate the solution. Continue reading
T-SQL stored procedures that return a single a value (scalar) or a single row can benefit from the use of OUTPUT parameters. This is not appropriate for multiple row result sets, but if you just need one value, or the results of a single row, you can do it most efficiently with OUTPUT parameters as opposed to SELECTing into a DataReader or DataSet. Continue reading
Intended for new developers, or at least new to ADO.Net, this post will demonstrate how to Create, Read, Update and Insert data into a MS SQL Server database. We will use a VB.Net winforms project, DataGridView and SqlDataAdapters. You can pull down the complete project from GitHub here.
UPDATE: I have also published a similar example application done with Code First EntityFramework 6.
The finished Form looks like this:
Do you remember, or have you at least heard of the old game show “Let’s Make a Deal”? This was the show where a contestant had to opportunity to win a car. All they had to do was guess which door the new car was behind. Two of the doors had a farm animal but there was a trick to it. After choosing a door, the contestant was shown one of the farm animals and then had to decide to stick with their first choice or switch their guess to the door they didn’t choose. What do you think the chances are of winning when keeping the first choice versus switching guesses?
The Visual Studio integrated tools for SQL Server are getting better all the time. While working solely in VS might not always be optimal, it is very convenient to not have to switch over to SQL Server Management Studio to do simple queries. Although the VS SQL tools may not be full-featured, you might just be able to get by with them and not need to install SSMS at all.
One of the less intuitive things to do is to restore a backup file that was created on another server. In this post I will show you how to easily do this in the absence of a right-click restore shortcut. For this you must run the SQL for RESTORE.
Today I thought I’d break out of the mold a bit and give the VB.Netters a little love.
I recently came across some code that was generating server-side HTML from rows of a DataTable. The data was similar to this one, rows would contain redundant header values (Category) and unique content values (Name, Value):