How to open SQL Compact Edition file(*.sdf) in Visual Studio or LINQPad?

[wp_ad_camp_1]

I try to look for some tools to open a sample database attached with application development sample on the net. I have found that the file has an extension .sdf. It make me strange at first because I do not really know what that file extension would be. Would that possible a database file or just a flat file? It is exactly as what I thought, it is an extension file for an SQL Server Compact Edition. A sample of Northwind.sdf (SQL Compact Edition 3.5) file can be download from my backup here.

Microsoft SQL Server Compact (SQL CE) is a compact relational database produced by Microsoft for applications that run on mobile devices and desktops. Prior to the introduction of the desktop platform, it was known as SQL Server for Windows CE and SQL Server Mobile Edition

This guide is provide the step on how to open the file content using either extension is Visual Studio or standalone application call LINQPad. I made these to share with you all in case that you need to see the data, schema of that SQL Compact Edition look like.

Currently there are two possibility to open .sdf (SQL Compact Edition):

  • Using Visual Studio toolbox

Visual Studio logo
It is support in Visual Studio 2015, 2013, 2012, 2010. You need to download SQL Server Compact/SQLite Toolbox from Microsoft or from my backup and install it into your PC.

 

Here are the step to integrated into Visual Studio:

    • Download SQL Server Compact/SQLite Toolbox for Visual Studio

You can download toolbox for Visual Studio from Microsoft Web site or from my own copy of SqlCeToolbox.4.5.0.3.vsix in case of previous link does not works.

    • Install toolbox extension

Before installing it is a must to close your Visual Studio if you are currently open first otherwise you can not see the change effect to your IDE, then double click on the file you have just downloaded to proceed to the setup process.

SQL Compact Toolbox

    • Install SQL Server Compact runtime

The Toolbox requires one of these SQL Server Compact runtime MSIs to be installed, if you want to connect to a SQL Server Compact database file:
Download 3.5 SP2 – installed with VS 2010
Download 4.0 SP1 – installed with VS 2012 (No runtimes are installed with VS 2013 and VS 2015)

    • Open Visual Studio to see toolbox extension being installed

Once the toolbox is installed, now it is ready for the feature of opening *.sdf file extension in Visual Studio.

SQL Compact Toolbox-002

 

It is time to try it out by your self from Northwind.sdf Read More

*How to disable your WordPress plugin directly in database?

[wp_ad_camp_1]

Hmm, fews days ago I got a big trouble while login to the site event if every credentials and reCAPTCHA value is correctly provided but I never had a chance to access to the admin panels.

Login

I always got the message saying that:

Error

It is strange because I have used this plugin Google Captcha (reCAPTCHA) by BestWebSoft since the beginning of website deployment and I have never had any trouble like what I had right now. With this, I have no ways to access to my website back-end to add more posts and comments back to all of your inquiries. It is a frustrate situation because I can do nothing to my home page as administration part of the WordPress can not be accessible due to authenticate error.

After relaxing awhile then finally, I found that we can only do manually disable the plugin either in PHP code or in database MySQL. Luckily, I have full right to access on both FTP and MySQL on hosting so, it is not very complicate to disable it if I knew the points where that plugin value are setting in the database. I preferred to do it via database rather then PHP code because it would take less time to understand the structure then scripting languages used.

Please backup your database and/or your files/folders before making any change. This can solve to restore back the website in case of any problem happen un-expected.

You can use whatever GUI to access to your database back end (MySQL). For my case, I used phpMyAdminprovided by my web hosting server. The plugin configuration is stored in a table called wp_options. Now, let try to look for active plugins with the following sql statement.

SELECT * FROM `wp_options` WHERE  option_name = 'active_plugins';

You should got something similar like this in your result set.

mysql_001

Here is exactly what my option_value are in my setting

a:7:{i:0;s:36:"contact-form-7/wp-contact-form-7.php";i:1;s:50:"google-analytics-for-wordpress/googleanalytics.php";i:2;s:33:"google-captcha/google-captcha.php";i:3;s:36:"google-sitemap-generator/sitemap.php";i:4;s:49:"social-sharing-toolkit/social_sharing_toolkit.php";i:5;s:39:"syntaxhighlighter/syntaxhighlighter.php";i:6;s:41:"wordpress-importer/wordpress-importer.php";}

As you see, I have had 7 plugin enables in system. But what I would like to do now is to disable is google-captcha. To do so, I need to change the value a:7: to a:6:. Means that only 6 plugin will be enable. Then remove i:2;s:33:"google-captcha/google-captcha.php"; from the field.

Finally, the my option_value is presented like this

a:6:{i:0;s:36:"contact-form-7/wp-contact-form-7.php";i:1;s:50:"google-analytics-for-wordpress/googleanalytics.php";i:2;s:36:"google-sitemap-generator/sitemap.php";i:3;s:49:"social-sharing-toolkit/social_sharing_toolkit.php";i:4;s:39:"syntaxhighlighter/syntaxhighlighter.php";i:5;s:41:"wordpress-importer/wordpress-importer.php";}

Once the change is updated to the database, then at login page, I see no more reCAPTCHA module embedded anymore. So I can passed through administration back-end of my homepage with only username, password, and no more Captcha validation. The selected plugin is now disabled. You can re-enable it again via Plugins tools of the WordPress. Disabling does not mean deleted it, it is just temporary block their activity.

Bravo! Finally everything is returning back as normal. I can manage my posts again ๐Ÿ™‚