Can I access MS Access file as Database for ASP.NET site without SQL hosting plan? - asp.net

I am creating a site with ASP.NET C#. Now my problem is I purchased one hosting plan without SQL database hosting, so can I use MS Access as my database for my site? I have taken hosting plan from net4.in.

Yes you can. Make sure you have the appropriate security access to the file - this can typically be done by putting the Access .mdb file in the App_Data 'magic' folder in ASP.NET. Update the connection string in your application configuration / web.config with the appropriate values.
Refer to connectionstrings.com for building / configuring the connection string.
Not all features available in SQL Server are available in Access and there might be slight changes to your queries / SQL syntax so make sure Access has everything you want before you go down this route - the extra cost of switching / upgrading your host will probably be less than modifying and retesting your code.
EDIT: ASP.NET also supports disconnected database MDF files in the App_Data - it might be worth checking with your host if they support this as you would not need to alter your code at all.

The short answer is yes, however I'd strongly recommend against it. The reasons for using Sql Server are limitless. Sql Server is much more secure and it performs better than Access when it comes to optimizing queries. The Sql Server Query Optimizer is remarkable in its ability to analyze the optimum route for pulling back data and is very efficient in preserving server resources.
However, if you are unable to pay the price for Sql hosting then you can certainly use Access. This article: http://www.aspfree.com/c/a/Microsoft-Access/Connecting-to-a-Microsoft-Access-database-with-ASPNET/ can help you get started... it is outdated, but it should get you on the right path for setting up the connection string to grant your application access to your MS Access data.

Thanks for all your answer but i tried by myself downloaded one sample application and uploaded on my server, and its working. So now i can use MS Access database on my server which is without SQL server hosting. As there was very small need for using database so i used MS Access here.

Related

How to backup and restore a SQL Server database in an ASP.NET app and get the backup file from a web page?

I have an ASP.NET web app on a shared hosting server and a SQL Server database on a database server. I would like to backup and restore the database programmatically in the web app where the site owner can download/upload the backup file from a browser. Looking for a solution which works in medium trust. I think SMO (shared management objects libraries) requires full trust and not sure if it even meets my needs. Writing files on the database server, using a control panel or SSMS is not an option.
While I might be able to write SQL Scripts to do all this work, it's going to take some time to have it work reliably for any database. I was wondering if these kind of scripts or a suitable library is available.
Based on the shared hosting, and the desire to get backups on-demand, you may need to actually run a SQL query that essentially iterates all the metadata and raw data and generates a bunch of SQL INSERT statements.
The good news is, this is a well-solved problem. See this question: What is the best way to auto-generate INSERT statements for a SQL Server table? or just Google "SQL script generator". If you look at some of the open source projects out there, that might be the easiest code to integrate.
With the caveat, it might be worth giving your hosting company a call and just explaining your needs, especially if they are a smaller company. I used to be Dir of Engineering for a small web hosting company and we'd setup ad hoc solutions for folks all the time.

web application development and database replication

Good Afternoon at GMT +8
I have to deploy a project using ASP.net to create a online payslip viewer. the problem is, our network would not host the web app, it would be from a different network, which would be a web host.
My problem is the database, to view your payslip, you should have access to your database, and my answer is replication.
However, my constraint to this approach is we use SQL server 2000 as our DBMS. as i have read in this article
http://msdn.microsoft.com/en-us/library/ms151763%28v=sql.105%29.aspx
the instance was tagged under SQL server 2008, could there be a way to replicate using SQL SERVER 2000? or are there any more ways that i could view data from our database online? without any direct link to our network?
I would also like to know if there would be another approch in regards to creating a simple payslip viewer online.
thanks!
There are several options here:
If you can move your database to that other server that would be an ideal solution.
Can you connect to your database server from external network? How about some kind of VPN? If speed is the problem then this might not work.
Other solutions could be creating another database in your host environment where application would be deployed and use one of many database comparison tools to synchronize the data between two databases but this is far from ideal especially if your application writes/update a lot of data.
One more thing you can consider is creating some kind of web service that you can use to communicate to your database. In that case you wouldn’t need secondary DB.

Asp.Net app using SQL Server CE 4.0 causes sharing exception with multiple clients

I have an ASP.Net 4.0 website which uses SQL Server CE and EF code-first for its data store. When 2 or more users are on the site I intermittently get the following exception about every 5th or 6th time.
There is a file sharing violation. A different process might be using
the file. [D:\directory...\file.sdf].
Throughout the code I create, use, and promptly dispose of the DbContext each time one is needed. Even though it is the default, I have added File Mode = Read Write to the connection string.
Any ideas what I might be doing wrong.
I think I figure out what happened. I found a link (unfortunately I do not recall where), that mentions that Go Daddy shared hosting uses a load balancer and multiple servers to serve the site. Even though the database file shows up on a drive mounted with a drive letter, clearly it must be located on a file server that all the webservers share.
Using SQL CE by multiple clients over a network is a nonsupported configuration. When I upgraded from SQL Compact to a SQL Server Instance provided by Go Daddy, the problem (and another data consistency problem I did not mention above) went away.
I am a little surprised that I did not find this problem when I googled it. Microsoft is pmarketing SQL Compact as a good back end for small website. If I am correct, this seems to be a significant liability in that regard.

Any ASP.NET Opensource project that works on both SQL Server and MS Access DB?

I searched on Google and I can't find any, do you know some ?
Not that I'm aware. Most open source projects however use one specific database engine (which makes sense), or xml (for example dasBlog).
However you can always swap your SQL Server for MS Access in a project if you want. The provider system for membership etc in ASP.NET itself is already a great example of that possibility (though not open source as it comes from Microsoft). For example take a look at this tutorial: Using Access instead of SQL server for your ASP.NET Application Services.
Personally I would rather find it strange to see an open source project making use of 2 different, especially MS Access in the first place. People tend to use SQL Server Express or SQLite or SQL CE for something like this.

Migrate Access to ASP.NET

The current application is a kind of CRM application built upon MS Access. The application is for internal use. My job is to migrate it to ASP.NET web-based application. Now boss requires to keep Access as database and develop ASP.NET code against it.
My question is, is there any disadvantages of using Access as database in ASP.NET application? (e.g. optimistic concurrency issue?) Should I persuade boss to upgrade Access to MS-SQL?
Many thanks!
We've used Access as a backend for web sites with good success. It's cheap, can be used effectively by moderately skilled programmers, and you can store the MDB on a document server so it gets backed up.
Most IT people dislike Access, but from a business perspective, Access can be very valuable.
MS Access is notoriously unstable in multiuser environments. A WEB app is by definition heavily multi-user.
So IMHO leaving MS Access as underlying DB is a call for trouble. At least use SQL Express (it is free)
The problem you are going to face in upgrading from Access to MS-SQL is that there is a major cost investment for the application. If your company already has the infrastructure in place(licensing, hardware...) then you won't have such a hard fight to pursuade your boss.
As for a technical answer:
I'd say you need to let you boss know that access databases aren't ideal for concurrent usage which a web application suggests is the intended goal of the application. My view is that Access is for database information that a SMALL set of users will be simply using for small data entry and querying. NEVER use Access to build an enterprise-level solution.
If you are planning to upgrade a Microsoft Access database to SQL Server 2008, use the SQL Server Migration Assistant (SSMA) rather than the upsizing wizard built into MS
10+ tips for upsizing an Access database to SQL ServerAccess.
Your boss probably likes to do ad-hoc stuff with access / excel. If you move the DB to SQL Server Express you can use Access and it's linked table feature to let your boss keep doing his ad-hoc needs through Access while keeping the data in SQL Server Express. If you keep the linked tables named the same as the old physical ones all his reports and queries will should keep working.
I'm an Access promoter, but not for use on websites because Jet/ACE is not threadsafe (though Michael Kaplan once said that is is threadsafe if you access it via ADO/OLEDB; I don't quite understand how a database abstraction layer can wash away a characteristic of the underlying database engine it's calling, but if MichKa said, it's 99% likely to be true).
Now, the exceptions would be if you're using it for prototyping something that will use a different database, or if it's read-only, or is read-write but will only ever have a very small number of users.
Michael Kaplan's website, trigeminal.com, used to use a Jet database as the back end (it may still -- I don't know that MichKa ever changed it), and when that was his main website he reported getting 100K hits a day. But it's a read-only site, so fits my restrictions.
There are so many different alternatives and they are mostly easy to use that I just don't see the point of trying to use Jet/ACE as back end for a website. I'd never do it myself (all the websites I'm responsible for use MySQL).
Simply put, go with MSSQL. Express edition is free, and will give you everything you need to migrate away from Access. These articles are talking about Access applications specifically, but the same issues will plague you.
http://resources.zdnet.co.uk/articles/features/0,1000002000,39285074,00.htm
https://web.archive.org/web/1/http://techrepublic%2ecom%2ecom/5208-6230-0.html?forumID=102&threadID=205509&messageID=2136367

Resources