July02

ClickOnce applications using VistaDB

ClickOnce applications have many benefits including ease of deployment, optional automatic updates and framework requirement checks.The only real complicated issue with ClickOnce is how to deploy the database. I can’t imagine trying to deploy Sql Server as a part of your application! VistaDB is a perfect fit to be embedded in a ClickOnce application due to the ease of XCopy deployment. Our 100% managed engine means you don’t need any permissions on the client side, no installs or registry permissions are required.  VistaDB can also deploy one dll to either a 32 or 64 it machine, there is no need to target a specific CPU type in advance of the deployment.

This article explains how to get a simple Windows Forms application (databound using Entity Framework) up and running with VistaDB and ClickOnce deployment.  There are a few manual steps, but almost all of these will apply to any client side xcopy deployable database. They obviously do not apply to SQL Server!

Databound WinForms Project

ClickOnce with VistaDB Screenshot

The Windows Forms project used in this example is very simple and consists of the following:

  • A VistaDB 4 Database containing one table named Employees with the columns and data shown in the grid to the right.
  • An ADO.NET Entity Model (EF model) of the VistaDB database, built using the Visual Studio wizards.
  • One Form (shown on the right) that contains a grid and a button that populates the GridView with a simple linq query against the EF model.

More...

June22

Building a plug-in model to load VistaDB - Part II

Plugins are used in data applications to support more than one provider from a single codebase.  The Provider Factories in ADO.Net is one such example, but you cannot work with the provider specific features when you use these factories since they only implement generic ADO.Net functions.  If you need to be able to use provider specific functions (like VistaDB’s DDA Pack routines), you have to load the provider somehow.  In most cases you put that logic and bindings into a separate assembly and load it when that ability is needed.  By taking this approach a little further and building interfaces you can abstract your logic to support more than one database provider using this model.

In this article I will explain more of how to code works to use VistaDB in a plug-in model previously explained in building a plug in model for VistaDB - Part 1. The application used to demonstrate the plug-in model is a simple windows form that allows users to deposit, withdrawal or check the balance of an account that is stored in either a VistaDB or Sql Server database.

We will implement the VistaDB custom plugins in this example.  You could implement other plugins for any other database you wish to support through the same interface.  In each case these plugins are hard bound against the database provider, but the actual application has NO binding to the database directly.  This is to allow it to run on machines where the database provider has not been installed.

Factory Classes in Main Application

The following classes are all contained within the applications main assembly.

Plug-in Factory

The plug-in factory is an abstract class that each custom plugin will need to inherit from to load from the singleton factory.

public abstract class PluginFactory
{
    #region public members
    public abstract BankModel.Provider ProviderName { get; }
    #endregion

    #region public methods
    public abstract BankModel GetModel(string connectionString);
    #endregion
}

ProviderName will return the name of BankModel provider, VistaDB or SqlServer. The GetModel method takes a database connection string and returns the abstract BankModel for that provider.

More...

May26

CornerstoneDB Schema Search Tool

Schema Search is an API from CornerstoneDB that allows users to search multiple database providers schema.

This tool is very useful for finding all stored procedures or views that reference a column through an API that works across multiple database vendors.  This is quite common when you want to update the schema for a database and you want to ensure you don’t break any existing uses of that column in the database. 

We also include a sample user interface to allow for interactive use of the API, and to serve as an API sample application.

Schema Search Sample UI

Schema Search UI

The Schema Search Tool sample WinForms UI ( and the C# source code) are included with every developer license.  This UI showcases the possibilities behind the API, and allows for quick interactive sessions when you don’t want to write code.

You can easily search database schema across the following providers:  Microsoft SQL Server, VistaDB, Microsoft SQL Compact (SQLCE) or MySQL.

The sample UI is very functional, and showcases the powerful Schema Search API in less than 500 lines of code.

More...

May13

CornerstoneDB Tools Beta Signup

We have officially launched the CornerstoneDB site! 

Beta signup limited to 100 developers

You can signup right now to be eligible for the beta on each of the tools.  We are seeking feedback from .Net data developers.  Give us your input and we will enter you for a chance to win free copy of each tool as they launch.  100 Developers will be chosen to take part in the Beta program for each tool.  Signup today if you are interested in getting early access to these great tools.

What is CornerstoneDB?

CornerstoneDB is a new brand of database tools for .Net database developers, and database admins.  These tools are things that we have needed many times in our own consulting with customers, and just for testing our own VistaDB .Net database engine

Each of these tools does not just work with VistaDB, so we didn’t want to name them under the VistaDB brand and confuse potential users.

What makes us different?

There are multiple tool vendors on the market already today, but the primary theme that I want everyone to understand is that all of these tools have one common design principal – API driven access to the system.  Sure, we will also offer desktop user interfaces to drive these tools, but that is not their real power.

Each of our tools is built first to be an API.  We want to enable you to build data applications that can do each of these functions, across multiple database vendors. 

If you want to enable a data generation, or sql script generation inside your application, that you can distribute to end users, we are the only solution available.

More...

May04

VistaDB Three Year Anniversary

Wow, it has been THREE YEARS since I took over VistaDB.  Time has flown by so incredibly fast.  It has been such an incredible ride, so many changes. 

NOTE: Information on sale was removed since it is no longer in effect.

Three Years of Releases

I thought it would be fun to go back through some of the releases over the past three years and highlight some of the major changes in each. There have been a total of 99 releases of VistaDB over this past three years, with only one regression in the code during that time (and it was my fault).

More...

March29

Rounding floating point numbers

A lot of confusion seems to exist around the ability to round floating point numbers, I am going to try to shed a little light on this topic.  Bear with me, the math may get a little involved, but the answers will be worth it (I think).

Float is an estimated data type

Approximate-number data types for use with floating point numeric data. Floating point data is approximate; therefore, not all values in the data type range can be represented exactly.

MSDN SQL Float Article

Float is never an exact number.  The number is internally stored in more than one part and has to be processed into something we humans can understand.  That means something like 1/3 can be represented as 33%, but it is not actually a nice even number.

For the full mathematical treatment of why this is so, feel free to read the fantastic paper “What Every Computer Scientist Should Know About Floating-Point Arithmetic”.  Warning, that paper is not for the feint of heart, it has a lot of math behind it.

The important thing to pick up out of that paper is that all possible numbers between 0 and 1 cannot be represented in 32 or even 64 bits. In order to store a complicated number with decimal places it has to be estimated.  This estimation introduces Rounding Errors.  When you start with one small error, everything that comes afterwards is not what you expect, these types of errors lead to errors like the Patriot Scud Missile Error.

A C# Example of Rounding

If you run the following C# code you will see an object that has a result of 5.1400000000000006.  Even though it looks like op1 = 2.56 and op2 = 2.58.

double type example

double op1 = Math.Round(2.562, 2);
double op2 = Math.Round(2.577, 2);
double opresult = op1 + op2;

Set a breakpoint on the opresult assignment and look at the value.  Now go into your immediate window and type ? opresult.ToString() and you will see an answer that most people probably expect (5.14).  But put your mouse over the opresult object and you see the actual value.

Result of two doubles added

I know at this point it probably seems pretty confusing.  A double is what VistaDB internally stores a FLOAT column type.  Why?  Because they match pretty well in bit size and what they can do, but it does lead to an interesting rounding problem like the one above.

Lets take the same code with a decimal type, what changes?

More...

February25

LINQPad helps you learn LINQ

Have you tried to use LINQ to query a databaseLINQPAD Logo using Visual Studio?  It can be a frustrating experience of things that compile fail at runtime, and that edit / compile / test cycle can quickly lead to hours of lost time trying to get a single complex query to work correctly.

LINQPad is an editor for LINQ?

LINQPad is sort of like a Notepad, you can write and edit .linq files using it.  But that is where the Notepad similarity stops. You can execute your LINQ queries and see the results without having to run your application.  It is truly something you have to watch in order to believe how much more productive it can make your writing of LINQ.

How I found LINQPad

When I was first working on the VistaDB product store and account manager writing LINQ queries against my Entity Framework objects was incredibly frustrating.  Most of the documentation and samples I found was for Linq2Sql, which is similar syntax… But not the same. And worse, most of the syntax compiles fine, but blows up at runtime with cryptic error messages.

My typical dev and test cycle was around 5 minutes to compile the DAL / Site, login to the account, navigate to the correct page, and visit the yellow screen of death from asp.net.  It was not fun, so I started working in a stand alone tester app I built just for this purpose.  Write the query, compile, debug, step, step, read exception and try to decipher it.

I was reading a post on Stack Overflow about one of those cryptic errors when someone suggested to the poster they use LINQPad to test their queries first before putting them into their apps.  Wow, what a great idea!  Where was this tool?  (You can download it for free from Linqpad.net )

LINQPad to the rescue

LINQPad allows you to execute single LINQ commands against an existing EF model, or even to write dot net code in the editor and execute it like a little dynamic dot net environment.  The main application is free, but there is an auto-complete feature to the editor that you must pay in order to activate. Believe me it is worth it to pay for the license, you also support the author and show him the application is worth money.  The license is very inexpensive and well worth the price in order to get intellisense like behavior on your LINQ queries.

More...

February09

10 things to make your desktop database apps better

NOTE: This article was originally published on the VistaDB blog, but has been moved to this location permanently.

Each of these items could be a blog post unto themselves, but I am going to try really hard to not be too verbose and just cover the core of the concept and why you need to do it.

Data driven applications rely on their databases

Everyone knows that any app driven by data is much more than just the app.  In most cases the app without a database doesn’t even function, or fails to function properly.  If a database is an integral part of your application, then shouldn’t you be doing all you can to ensure it stays healthy and prepare for the worst case events of corruption or dead drives?

This week we have been contacted by 5 long time users who suddenly lost or corrupted their data.  Two of these were end user data that is going to cost a huge amount of labor to reproduce.  In all of these cases the following simple procedures would have prevented the situation entirely.

More...