Check sqlce database existence as per web.config?

Have a look at the source code here, it detects if a SQL CE database file is present in an ASP. NET app, and creates it with tables if required: sqlcemembership.codeplex.com.

Thank you so much for the link. In the mean time I have tested using "Verify" method and it worked. I will try your link and let you know.

– Hoque Feb 15 at 18:37.

See support.microsoft.com/kb/272210 Use this as your sqlcommand select statement. SELECT * FROM INFORMATION_SCHEMA. Tables WHERE TABLE_TYPE='SYSTEM TABLE' The reason your command is not working is because the sys.

Databases table doesn't exist in sqlce only in a full blown sqlserver. See http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection.connectionstring(v=VS.100).aspx for options that can be used in SqlCE connection strings.

This will tell me wether any table exists or not. I am looking for whether any DB exists or not. – Hoque Feb 13 at 23:11 @Hoque as sqlce only supports one database in one file, if you have found the file, you have found the database.

There are no more databases in your file. The fact that the queries succeeds is proof of the existence of the database which is the nature of your original question. – rene Feb 13 at 23:21 based on the database non-availability, I was trying to create database.

Therefore, initially I do not have any table in the databse. A database may or may not have any table. So, if I looking for any table in the database, it will not give any true picture about database availability.

– Hoque Feb 14 at 0:56.

I Think you need to specify the connections where sqlce database is located. Try this link. Connectionstring.Com / Sql Compact Regards!

In the connection string it has been told. – Hoque Feb 14 at 0:48 have you try. Data Source=//MyFilepath//MyData.

Sdf;Persist Security Info=False; – Crimsonland Feb 14 at 1:05 do you think the following Data Source is not valid : connectionString="Data Source=|DataDirectory|db. Sdf; – Hoque Feb 14 at 3:24 It is also valid..but try to test another constring given on connectionstring. Com ... and test it.

– Crimsonland Feb 14 at 4:38.

Finally I found the way to detect whether the DB exists as per connection string. Under the "SqlCeEngine" class there is a method named "Verify" by which it is possible to detect. String conString = ConfigurationManager.

ConnectionStrings"sqlCEConnectionString". ConnectionString; using (SqlCeEngine objCeEngine = new SqlCeEngine(conString)) { if (!objCeEngine.Verify()) { objCeEngine.CreateDatabase(); } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions