Friday, July 29, 2011

Web browser control does not display data in WPF window if window's allow transparency is true

Windows from have web browser control since .net 2.0, WPF also introduced a browser control from .net 3.5 sp1, well the controls are very good as far as functionality is concern, i my self prefer windows forms browser since it have more control with the functionality.

Today i encountered with a strange problem, in one of my application i used a modal dialog to present data as light box effect, inside the modal i added a browser control and then populated appropriate data, when i run the application the modal showed up, but the browser was just blank, no data what so ever. Later after few trial and error i found that my modal windows allow transparency property is set to true,  when i turned it to false, browser's content showed up.

Its a small problem perhaps many of you already knew about it, but since it killed almost two hour of my time, i thought its worth sharing. Happy coding..

Wednesday, July 27, 2011

Using SQLite with Entity Framework in Visual Studio 2010

Introduction

In my previews blog post we have seen how using a simple “data provider” provided by http://sqlite.phxsoftware.com/ can make our life easier in context of SQLite in .net. In this short article we are going to see how we can use SQLite to generate Entity Framework Data model.

Choosing the Provider

First thing first create any type of project in Visual studio 2010. But I would prefer an web application or windows forms or perhaps a WPF application. Now click on project and select add new item to add a new item type. From Add new item wizard select “Ado.net Entity Data Model” and click on add this will brought up the Entity data model wizard.

  • Step 1: Select Generate from Database
  • Step 2: In next window select New connection
  • Step 3: Connection properties window will popup and the select right kind of provider for SQLite.
  • Step 4: After that the Connection properties will have browser or New db,

Create Data Model

  • Step 5: Now select existing db if you have using browser or New to create new db.
  • Step 6: Continue with the wizard to select database table items to include in model.
  • Step 7: Click finish to close the wizard and a data model will be generated for you.

Data Model Created

If you had any relationship in the database those will be automatically be synchronized in data model, that’s it we are good to jump in the code to retrieve data and do all type of necessary stuff that we must do in a database. Best of luck and happy coding.

Edit SQLite database using Visual Studio 2010 or SQLite Administrator

Introduction

In my previous blog I have shared few useful information about SQLite Embedded database and how to use its provider to create an connection using System.Data.SQLite. We have also seen a simple tool named “SQLite Administrator” which is very handy to use with SQLite database. In this short article we will see that how we can create and manipulate  data using Visual Studio 2010 or SQLite Administrator.

Creating Table in Visual Studio 2010

Select the SQLite connection that you created and expend the Tables node, then right click and select “Add New Table” that’s it you are good to go to add a table just like the bellow figure. I am sure you guys have done this hundreds of time in SQL server, this time its just SQLite. you might see a warning when you first enter into edit of table editor.

Creating Table In VS2010

Using SQLite Administrator

Double click on the SQLite database file and right click on tables and click "Create Table”, rest of the UI is fanatic to Create the table. Set field as primary key or assign auto increment to primary key all can be done via simple clicks. So no custom hand written SQL any more.

Edit Table in SQLite Administrator

Creating Relations in Visual Studio 2010

Creating table relations are easy in visual studio, just click on relation icon, the icon beside primary key, in fact to be precise right side icon of primary key button. Or perhaps you can select a table and then click on relations, this will popup an widget to create relation.

AddRelation

Creating auto increment primary key is a not that much difficult also, now a days in every table we use auto increment key so we must discuss about it. at first glance we didn’t find any button or option to assign it directly. You can use SQLite Administrator to add it in few clicks, but to add in Visual Studio 2010 you got to bring the indexes window, just click on Indexes after that you will find option to add auto increment column.

Edit Auto Increment in Vs2010

I hope this information's will be helpful to us to work better with SQLite. Hope to write more information's about SQLite in near future. Happy coding.

Tuesday, July 26, 2011

SQLite management tool.

SQLite have lots of management tools, some of them are open source and some of them are trial ware and some of them are commercial. I found “SQLite Administrator” Pretty easy to use and handy tool as far as SQLite database file is concern.

A complete list of SQLite management tools can be found here “http://sqlite.com/cvstrac/wiki?p=ManagementTools” download the use what ever best suits you.

Today I am going to talk about only in SQLite Administrator, It can be downloaded from the following site.

http://sqliteadmin.orbmu2k.de/

A Complete list of feature is given In that site.

image

Features:

  • Create / Modify / Delete Tables by Wizard
  • Create / Modify / Delete Indices by Wizard
  • Create / Modify / Delete Views by Wizard
  • Create / Modify / Delete Triggers by Wizard
  • SQL Code Completion that supports table aliases
  • SQL Code Highlighting
  • SQL Error Locating
  • Import Data from CSV Files
  • Export Data ( XLS / CSV / HTML / XML )
  • Store User Queries into Database
  • Search for User Queries
  • Store Images into Blob Fields ( JPG / BMP )
  • Show SQL of each Database Item
  • Migrate SQLite2 Databases to SQLite3
  • Try to keep Indices and Triggers after modifying a Table

 

Note

This tool need no installations what so ever. The whole package is in a zip file and need zero installation, just unzip and open the exe that’s it, and All of the functionality is pretty easy and it has very intuitive UI. I would recommend it to every one who work with SQLite.

Using SQLite in Visual Studio 2010

Introduction

Every now and then we need a simple database solution which is light, small and pretty easy to use. What more can be useful other than SQLite, A simple yet very powerful tool to support database for any kind of application needs. When we started this research work we had a particular focus to choose right kind of database depending on few criteria.

  • We don’t want to use a service based database rather a file system based database.
  • Client have to be light, fast and support blob data.
  • We don’t want to install any client or framework in client machine

 

Background

After few minutes of research in the internet we came up with few embedded file system database that can be used in .net and has support, necessary tool and provider.

  1. SQLite
  2. SQL Compact Database
  3. Firebird

Among those SQL Compact DB is really have good support with visual studio IDE and very easy to use but it has its own limitations and we would definitely discuss in future about it. But the end result was that we found that SQLite is winner in every case and that’s why we choose to recommend it in this short article.

Adding the provider

Change Data Source

Next step is to add a data connection in server explorer in Visual studio 2010. When you click on add connection by default you don’t have provider added in visual studio, so we have to add it using a third-party tool. You can download the provider for SQLite from http://sqlite.phxsoftware.com/ site. “SQLite-1.0.66.0-setup” this is the version we used for this particular case. When you install this provider you would be given an option to integrate this in vs2008 and vs2010.

Installing the provider

After installing the provider when you get back to the add data connection in server explorer you would see an new provider is available for SQLite.

Adding the connection is Server Explorer

SQLite Provider

Go ahead and click on after choosing SQLite Database File. Next we will be presented with a screen where you would either choose an existing database or created a new database file.

Create New SQLLite DB

That’s it your connection string and database connection is set up and you are good to go with design of the database. Few interesting note on this particular case. My SQL database have no database diagram support yet. But we hope that this will be provided soon. After adding connection we can created tables and add necessary relations to the table.

Conclusion

In this short article we have seen that how easily SQLite can be used in visual studio 2010 using a provider to create connection in server explorer. Next we would discuss how to use SQL Lite to create a data layer using Entity Framework.

Update

New article with new provider by SQLite org is published here http://munnaondotnet.blogspot.com/2012/06/using-sqlite-in-visual-studio-2010-with.html

Friday, June 10, 2011

BCL : PDF converter and sdk for easy use.

Hi recently we developed a Silverlight component for one of our client and used some very interesting technologies. I thought those are worth sharing. If you are thinking about converting your PDF document to word or some other format I would suggest you use BCL component. You can download the sdk as well as the trial software from http://www.pdfonline.com/.

image

There could be lots of technologies for converting documents from one format to another but sad thing is noting is free. You have to pay to use this component so some financial bottleneck is involved. I would very much like to see some free component in future. In those cases open source software's would have had those rich conversion facilities.

image

Until we find free products for conversion, this is a good choice.