Monday, 9 July 2012

Opening a SQL Server 2012 database in Visual Studio 2010

After installing SQL Server Express 2012 and using the SQL Server Management Studio to create a database, I found that I couldn't integrate SQL Express 2012 into the Visual Studio Server Explorer in a way that VS listed all my 2012 databases. VS would show databases from an earlier 2008 SQL Server I had installed on my PC but not the 2012 version.

The only way I could show the DB was to add a connection to a database file. To do this I had to:-

1. Right-click the Data Connections node in Server Explorer and choose Add Connection...

2. Make sure the Data Source field was set to SQL Server Client as shown in this pic.:

3. Then in Server name field type in the name of the new SQL Server Express 2012 instance. In the pic. above, the name of my server is SLIQSQL but for a default installation of SQL Server Express, the server name is likely to be SQLEXPRESS (I just chose a different name during the installation process).

4. Then press the Test Connection button. If all is well you should get a Connection Succeeded message.

5. Finally, choose the database you want to add in the Select or enter a database name field and press OK to close the dialog.

The chosen database should now show in the Server Explorer.

Where does SQL Server 2012 store database files by default?

If you're playing around with SQL Server 2012 and you've created a couple of databases, e.g. in SQL Server Management Studio, you may not actually know where the databases are stored as during the whole database creation process you don't get asked to specify a file path.

To find out where your database files are stored do the following:-

1. Open SQL Server Management Studio
2. Right click the server name in the Object Explorer pane on the left and choose Properties.
3. In the Properties dialog, choose Database Settings in the Select a Page pane on the left.

The database file locations are then shown on the right.

Saturday, 30 June 2012

VistaDB vs SQL Server Express for Multi-User apps

For the past 4 years I've been using VistaDB (version 3 or 4) in a number of development projects. For a SQL relational database with minimum dependencies, i.e. all it requires is the .Net framework, VistaDB is hard to beat and makes deployment as an embedded database real easy, adding little more than 1MB to an installer. Overall, as an embedded database in single user applications, I haven't found anything to compete with it.

VistaDB however does have a few drawbacks that make it unsuitable for larger, multi-user applications which means I'm now looking at using SQL Server Express in some new applications. VistaDB will still be a part of some of my future apps but not part of apps where I want to offer true multi-user capability.

In my experience, the key drawbacks of VistaDB for multi-user apps are:-

1. The lack of a client/ server model. Instead, each VistaDB client directly access the database file and Windows itself manages file locks and such. The result is that when 2 or more users try to access a database file simultaneously access times go through the roof and the app crawls along.

2. VistaDB's lack of paging support, e.g. something like MySQL's LIMIT, OFFSET commands, means that it is hard to avoid reading whole SQL tables of data from the DB to present in lists. Reading large amounts of data from a shared file can compound the Windows shared file performance drop from point 1.

3. In a multi-user app with concurrent access, SQL transactions are essential to ensure consistent updates across tables. Unfortunately, VistaDB transactions are extremely slow causing application performance to drop.

The points above aren't complaints about VistaDB - multi-user apps aren't what VistaDB is intended for. My only disappointment with VistaDB is that it's so good, I just wish there was a simple, easily deployable, client/ server version.

As I gain more experience with SQL Server Express, I'll try and list more pros and cons. One good tool I've found so far for use with SQL Server is OpenDBDiff. This is a free, open-source tool for comparing schemas of two different SQL Server databases and generating SQL scripts to make the schemas match. I can see this tool being essential to ease field upgrades of SQL Server DBs. With VistaDB today, I generate schema update code by hand, so it's a nice, early bonus to find an automatic way of doing this for SQL Server.

Saturday, 23 June 2012

Article Marketing Software

Article submission is still an efficient way to help boost the performance of a site in SERPs and is a good way of publicising information such as a new service or product you are offering. There are a number of good article submitters on the market including Article Marketing Robot and Article Demon. However, a new article submitter has recently been released - SliQ Article Submitter - by the developers of SliQ Submitter Plus.

SliQ Article Submitter lets you submit as many articles as you like to as many directories as you can find. Although the package comes with a small list of article directories you can easily add your own. The software supports Wordpress, Article Dashboard, MS and Setup amongst other scripts.

The new article marketing software follows a similar design to the familiar Microsft Office packages and with a clean, fresh layout the interface is designed to make article submission achievable even for those people who've never performed article marketing before. Even though the package is suitable for newcomers to SEO, the package still includes all the features a professional SEO will need including automatic account creation, automatic email verification and a live link checker allowing the user to build up a list or report of live articles. For the regular subumitter of articles there is also an in-built scheduler that lets the user queue up registration/ account creation, email confirmation, submission and even live link gathering tasks to be performed on a user-defined timescale or schedule.

To find out more about SliQ Article Submitter, check out the article submitter info at

Wednesday, 11 November 2009

Beyond Compare - File Comparison Tool

Sometimes it's the simplest activities that take the most time. If you're in the game of software development making changes in multiple versions of source files is a frequent and not very interesting activity. You'll often be working on your next major version then need to make a new minor version release either due to a problem in the current release or a need to support some new feature (like an unexpected tax rate change).

I'm showing my age here but in the past I've always used Windiff (in my Visual C++ 6 days). Windiff used to let me find out what the differences were between files. I could then merge file contents using a text editor. This process works but it was sometimes difficult to get files to match exactly as there were often extra spaces of line breaks.

Windiff disappeared from Visual Studio 2005 so more recently I've even restored to the old DOS FC command. I did have a quick play with Visual SourceSafe but the solution wasn't really flexible enough - often I want to compare and merge files without locking something down in a configuration management system.

However, I recently came across a package called Beyond Compare from Scooter Software. This package is absolutely fantastic and is now my second favourite software tool (after Visual Studio).

There are a number of good things about Beyond Compare.

Firstly it remembers folders you've compared in the past. This means you can do a new comparison and merge more easily the second time.

Secondly it lets you move updates from one file to another with a single mouse-click and shows you the results. Any extra/ missing whitespace differences are easily ignored. This makes merging versions take minutes rather than hours.

Thirdly, the software tool itself presents a trustworthy user interface. As you're doing a compare and merge with Beyond Compare, you can refresh the file comparison on the fly and check that things are absolutely identical. Knowing things are the same - bar the differences you want to keep - is vital to ongoing software development.

If merging files and versions of software is something you do regularly I'd recommend going to the Scooter Software site and taking a look at Beyond Compare.

Saturday, 11 July 2009

PHP, MySQL date and time formats

PHP and MySQL have different formats for storing dates and times. This can cause confusion when trying to compare a date in PHP and a date stored in a MySQL database.

PHP stores dates and times in Unix or UTC format. This format encodes a time as an integer count of the number of seconds since New Years Day began in 1970 (1st Jan 1970). MySQL on the other hand stores dates and times in string format. All three MySQL date/ time types DATETIME, DATE and TIMESTAMP store data in string format.

MySQL DATETIME and TIMESTAMP columns store in the format:


MySQL DATE columns store in the format:


PHP and MySQL date/ time comparisons

Obviously, this difference in format causes problems when inserting dates and times into MySQL databases and especially when comparing MySQL and PHP dates for example trying to select entries from a table where a date value in the table is older than a PHP date. The easiest way to do this is to use the UNIX_TIMESTAMP MySQL function. For example:

// You could get the date as three integer values from a querystring on the PHP page:
$day = $_GET['day'];
$month = $_GET['month'];
$year = $_GET['year'];

// Then use the day, month and year to construct a PHP time (in seconds since
// 1st Jan 1970 format).
$datetime = strtotime($year.'-'.$month.'-'.$day.' 00:00:00');

// Then find all entries newer than the date given by the querystring arguments.
$sql = "SELECT * FROM MyTable WHERE UNIX_TIMESTAMP(UpdateDate) >= '" . $datetime . "'";


The above SQL query causes MySQL to convert the value of the DATETIME (or DATE or TIMESTAMP) value in the UpdateDate column in the hypothetical table into a PHP format date before doing the compare.

Storing a PHP date/ time value in MySQL

To convert a PHP format date/ time into MySQL's format, the MySQL FROM_UNIXTIME function can be used. For example:

$currenttime = strtotime("now");

$sql = "UPDATE MyTable SET UpdateDate = FROM_UNIXTIME(" . $currenttime . ") WHERE ... ";


Don't use strings for PHP/ MySQL date > or <>

You might find some PHP code examples, trying to use the PHP date() function to format PP dates and times as strings in the correct format to match MySQL values. If you can remember the correct format strings for the conversions this will work as long as you are setting values in rows. For comparisons however, strings aren't any good as the comparison will be an alphabetic/ string comparion and not the required date comparison.

Thursday, 7 May 2009

VistaDB, SQLite and Microsoft Access

Recently I've been carrying on my investigations into databases. SQLite originally looked promising as an alternative to Microsoft Access - read my SQLite investigation post for more info. SQLite looked small, fast, robust and very easy to install. However, I eventually decided it wasn't going to work as an Access replacement for me.

The main reason I decided not to replace Microsoft Access with SQLite was that I'd got too used to ease with which I could get when using the .Net datatypes seamlessly with Microsoft Access, e.g. I could read and write the .Net Decimal type straight to Access. With SQLite it seemed that I might have to convert to and from strings to preserve accuracy. This wasn't a big showstopper but I'm afraid I like my programming to be as easy as possible.

I'd pretty much resigned myself to using Microsoft Access but then I came across a really neat database system called VistaDB. VistaDB looks (I suspect) like it may have been originally based on SQLite but the great thing about it is that it has the rich data type support you get with Microsoft Access - plus extras like stored procedures - without losing the no hassle deployment of SQLite. I've spent a few hours evaluating VistaDB and so far it looks ace. For my particular application it solves all the downsides of both SQLite and Microsoft Access.

Monday, 6 April 2009

SQLite and ADO.Net: Acting as an Access replacement

I've had a bit of a play recently with SQLite and ADO.Net to see if I could slot in SQLite instead of MS Access in my desktop application. As yet I haven't made my mind up, but it's been a very interesting exercise. Here's a quick summary of my findings so far.

DataType Support

With my limited experience, SQLite seems to support fewer data types than MS Access. On the whole this isn't a problem apart from two areas - the .Net Decimal type and the .Net DateTime type. In both these cases I think you end up having to encode the data as strings and take care of any localisation issues yourself, e.g. making sure dates stored in France can be read in the UK and vice-versa. I haven't delved into Decimal storage too much but I think strings will need to be used instead of squeezing data into the Double data type and experiencing potential rounding errors.

Complete ADO.Net Support

The SQLite support is pretty comprehensive but misses out in one or two areas like the RowStatusUpdated event handling.

Error Handling

If you open a connection to a non-existent DB, SQLite seems to create an empty database at the specified path. This isn't a big issue but it means that the "DB doesn't exist" error turns into a "Table doesn't exist" error when you try to access a table in the DB.

Note: Since I wrote this post, I've found out that you can use connection strings to alter the default behaviour of creating an empty DB when the target DB can't be found. Read SQLite Connection Strings for more info.


On first impressions, data access with SQLite is very quick and certainly quicker than MS Access. However, if you have to start encoding and decoding data into strings (DateTime for example), I'm not sure that the performance wouldn't start to degrade.


With SQLite there is essentially nothing to install. All you need to do is copy the assembly into your application folder and you are up and running. SQLite wins hands down here.


None for now, except to say that SQLite looks very tempting as an Access replacement especially as it's so easy to deploy. I'll post more info as I gain more experience.

Sunday, 1 March 2009

SliQ Invoicing 1.6 Released

SliQ Invoicing 1.6 has now been released. Although it's only 6 weeks since version 1.5.1 of SliQTools invoicing software was released, 1.6 is quite a significant update. In 1.6, a number of options have been added to allow customers to modify the provided templates for invoices, quotes and credit notes.

As of 1.6, templates can now optionally include a tax rate column. If desired, the tax value column can now be ommitted and users who are VAT/ tax registered can now choose whether the total column is the gross or net amount. One of the biggest additions to version 1.6 however is a label editor.

The label editor is provided on the Template Setup tab. The editor lists all the fixed text labels on the selected template preview and lets the user enter their own value. For example, US customers might like to change the Delivery Address label to Shipping Address. Using the new label editor it is even possible to fully translate the standard templates into Spanish, French or German for example.
For futher details of the modifications and additions in SliQ 1.6 and to download the latest copy, visit the SliQ Release History page.

Tuesday, 13 January 2009

Free Software Downloads

In the past couple of weeks, SofwareLode, a shareware downloads site has been growing in popularity. More and more pages are being pulled out of the supplemental index and the number of page views per day is now into the thousands.

There are a number of reasons for the increase in traffic.

  • Being a shareware directory, SoftwareLode naturally builds links over time as authors link either to the homepage or to the details page for their software packages.
  • As well as an increasing number of links, better internal linking has also helped. Each software details page now links to up to 10 related programs, i.e. programs with the same keywords. Getting more, relevant links to the program details pages helps pull pages out of the supplemental index.
  • Better linking from the homepage into the rest of the site spreads the homepage PR around more efficiently. The homepage now lists top selections in a number of categories. The details pages for the top selections then link to related programs and so improve the rank of lots of the inner pages.
Breaking away from the usual software downloads site categories also seems to be showing some benefit. The antivirus software and free dvd software pages seems to be attracting a decent amount of traffic these days.

As SoftwareLode was launched only 7 months old, I'm pretty pleased with its performance and hopeful of further increases in traffic in the months ahead.