SQL CE 4 vs Files on a website - asp.net

I am looking at moving all data loaded from files into drop downs, variable calculations, user state, Session Memory(hardcoded..),etc to be all loaded rather from SQL CE. Plus would be have it running in a MemCache or App Fabric layer but we don't have that luxury so we stuck with using Session or file loads to read the temp storage data. The data's too small to be kept in SQL Server as well as it's on a different machine on the network so compact edition seems to be a good option. It sounds like it's a viable option as you get a trimmed down db on your site versus files/session memory.

You should use Session for temporary storage, but replace all code that uses filesystem for storage with SQL CE, with files on filesystem you have to have some sort of thread isolation for different users of your ASP.NET application and with SQL CE you got that out of the box.
If you have to have some sort of search on that data, searching bunch of files is not very feasible.
In general I would sure preferred SQL Server Compact than files.

Related

Is it possible to store a pseudo SQL Server database for my ASP .NET project?

My ASP.NET project is using SQL Server as the database. I am wondering if it is possible to store a temporary instance of my database so that I would only need to query once to work with the data that I need. For example, I will query the 2 tables, Person and Students with a common id. I want to be able to join the tables and use the information.
I think there are some solutions:
Store the tables in the front end and use ajax javascript to manipulate the tables information.
Store in a txt file or similar file on to the project folder as a pseudo database.
Would love to hear any ideas!
You could do worse than consider SQL Server Compact edition:
https://www.microsoft.com/en-za/download/details.aspx?id=17876
Which has a small footprint and supports private deployment of its binaries within the application folder
EDIT:
It seems CE is deprecated since last I used it. and MS now recommend SQL Server Express Local DB
https://learn.microsoft.com/en-gb/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-2017
And there is also SQLLite: https://www.supinfo.com/articles/single/6941-an-aspnet-core-mvc-app-with-sqlite-and-entity-framework

Export Sitebuilder SQL Server database to Excel | CSV | MySQL

I need to migrate a customer's site which happens to be hosted in a remote Win32 environment with Sitebuilder, Plesk, SQL Server and ASP or ASP.Net, I'm not sure.
I'm used to LAMP environments, so I don't know what to do with all the files in this server. Sitebuilder and SQL Server are also new to me.
I only have access to the FTP files and to the Plesk panel control, but it doesn't even acknowledge the existence of any SQL Server database (as it usually does with MySQL databases).
So far I've only been able to think of these two options:
Code an ASP script that writes down the database content into CSV files (wouldn't know where to start).
Code a script that retrieves the data directly from the HTML pages (long, painful, error prone and not useful to access data available only to logged in users).
So my question is: from your experience, knowledge of this platform, and point of view, which would be my best option?
Thank you very much in advance in my first question here. Regards,
UPDATE: I've managed to access the server (Windows 2008 server + SQL server 2008) using remote desktop. I guess I should be able to export the database now. I'll check Management Studio to see if it can help in the process.
It sounds odd that it doesn't support remote connections, but if you want to do it from within your asp-pages, the following links might be good starting points:
Want to script all objects which depend on a SQL Server table
http://www.dotnetfunda.com/codes/code32-how-to-generate-create-table-script-for-all-tables-in-sql-server-database.aspx
https://dba.stackexchange.com/questions/20355/generate-create-script-for-all-indexes

Should I go with attaching MDF file to SQL Express or a real deployment script to SQL Server?

I am building a blog-like publishing system on ASP.NET 4.0 (with EF 4.0) that I want to be very easily deployable/backupable in the first place. I am at a decision point of whether making the system to create a database in an SQL Server and use that (traditionally), or have a App_Data MDF file in the site and just attach to that one with SQL Express. I know the memory/size limitations of Express editions, and I won't be hitting the limits as this is not a performance-critical business application or any serious stuff. Just a simple CMS with blogs/writings/photos (actual photos are NOT saved in database, just their paths are saved in MDF) and that's it. I see no problem using MDF, but I'm not an expert on the topic too as I've never worked/created a website using MDF file. I always deployed on the SQL Server, but I don't want to deal with users/roles/permissions and the last thing that I want to have a user having installation problems due to database settings.
What should I go with? Any problems that I would face with MDF? Recommendations?
IF you use SQL Server Express - which is a server - I would always opt for a "real" database approach: attach your database to the server, access it by its database name, deploy SQL scripts to update it.
That "attach DB from file path" always seemed like a half-baked and rather messy kludge to me.....
If you don't need that kind of power - investigate SQL Server Compact Edition which is a one-file only, in-process database. It has its limitations - no stored procedures, doesn't support certain data types like VARCHAR(MAX) or XML - but for easier scenarios, it's perfect and easy to use - just deploy it along your app. It's single-user, e.g. you don't share the data between several clients, it's a local store for each user/app on its own

ASP/ASP.net: Web-based JET database management tool?

I need to manipulate some tables in a JET database housed on a web-server:
check existing indexes
change table cluster/primary key
see what tables exist
rename tables
add tables
drop tables
browse data
etc
I don't have the option of installing PlaneDisaster or Access (even if i had it) on the local machine.
I've already written a generic web-based query tool. I'd rather not have to get into writing a whole web-based database maintenance GUI. Someone must have done this already, and probably many times over.
A partial answer might be Compare'Em
http://home.gci.net/~mike-noel/CompareEM-LITE/CompareEMscreens/CompareEM-About.htm The Pro version allows you to create SQL statements to update the Access database file. This will allow you to generate the differences between one version and a newer version.
His website isn't very clear but as I recall the price for the Pro version was $10.
As you say you have already done a generic web based query tool. The problem with JET is that you cannot connect with it as database server like you can do with one SQL server in order to process changes to tables and other maintenance procedures. Jet is is not a client/server RDBMS. You need to have an application in the server to do that for you as you already have done with your generic web based tool, or download the database to your machine. That's why you have done some procedures and locate them in the server as asp pages.
Anyway you can use JetSQLConsole, if you don't want to use Planedisaster or Access, but remember that you need always an application on the server to to the job for you
You can also use access "in your machine" and connect to a database located in a URL (http://myserver/mydatabase.mdb) but remember when you are doing this you are downloading all the database and when you save it you are uploading it again.

Where to find state.sql for sqlserver mode sessionsates?

I am looking for the state.sql file provided by the .NET framework to run sessionstates in sqlserver mode. Where can I find the sql file to create the required tables and stored procs. I tried in the FRAMEWORKS/VERSION2.0 folder but I am unable to find it.
It's not state.sql anymore, but InstallSqlState.sql or InstallPersistSqlSate.sql.
Choose InstallSqlState.sql, if you would like to store your session data into tempdb (and thus to lose all sessions on every SQL Server restart). Or choose InstallPersistSqlState.sql if you would like to store them persistently.
This article has a great overview of both modes (temporary and persistent db), and the script is linked to from there also...

Resources