After I wrote "select between SQL Server express and compact", some friends in the garden asked SQL Server Lite version (sqlce) does not support ASP. NET? At that time, I was not sure. I did not test it myself, but I felt strange and could not support it without reason!
Today, I read Steve Lasker's blog and finally figured it out!
Because sqlce does not support ASP. NET by default, many users make requests to Ms, constantly complain, or even intimidate (if you do not allow it to support, I will use XX product ). Steve Lasker finally got stuck and came out to clarify everything.
In fact, the sqlce market position is very clear, mainly to solve the problem of offline data storage and synchronization of Smart Clients. The selection between SQL Server express and compact is also clarified. Therefore, Microsoft has not optimized the use of sqlce as a Web site database. In the environment of multi-user access and data concurrency on the web site, the performance of sqlce is not ideal, which is incomparable with SQL Server Express. Therefore, we recommend that you use SQL Server express or SQL Server database for the web site. You must know that sqlce is an embedded database engine, while SQL Server Express is a database service. The hosting toolkit SQL Server recently released by the SQL server development team can help you deploy SQL Server express on the Web server.
So can ASP. NET use sqlce for data storage? Yes!
By default, sqlce is blocked when the sqlce database connection is enabled in the ASP. NET workflow. You can use the followingCodeRemove this restriction:
Appdomain. currentdomain. setdata ("sqlservercompacteditionunderwebhosting", true)
Note that sqlce Data Synchronization cannot be used in ASP. NET.
In short, you should not use sqlce in ASP. NET if you want to use it, so pay attention to the consequences!
Refer:
SQL Server compact edition under Asp.net and IIS
Sqlceconnection class (system. Data. sqlserverce)