Advice required: Creating desktop application with database connectivity - asp.net

I want to create a desktop application, I normally work on web based applications so have very little knowledge about creating console applications using .Net and visual studio.
So now in this application I'l also be using database connectivity and stored procedures (SQL server). But how should I start doing this as I dont want to install SQL server on my clients system.
thanks in advance..

I think it depends on the goal of your application, the amout and sturcture of the data and the environment. The last point aims to the client system, if the client is part of an enterprise network (e.g. Active Directory) or is a common user at home.
maybe you can use xml or json files to store the data
if you need a database, you can create a setup project for your application which automatically installs a SQL Server express
another way is, if it's applicable for you, your application can consume a webservice which provide the data

you could use SQL Server compact http://msdn.microsoft.com/en-us/library/cc645984(v=sql.100).aspx or SQL Lite to embark your DB in your application without external dependencies.
Otherwise, if offline isn't a requirement, you could go the "cloud" way, with web APIs

Related

Connections issues with MS Access to ASP.NET web application

I have hit a wall and can't figure out the heads from the tails. I am working with a team and we have developed an asp.net web application. There is a feature on the application that delivers directions from a database. The database is an MS Access database. I have published the application to an IIS7 Windows server. I also uploaded via FTP the Access database. We have tried all manner of connection string variants. We did not import the database in any way into Visual Studio but prefer to connect to where ever we decide to place it.
Now, I am wondering if using Access was a bad idea. Its a given that it was a rookie mistake since we are students working on our capstone project. Is there any other installs for the Access database that need to be installed on the server other than the driver for Access? Should my connection string be structured any other way that what it is presently? I will post the string below. Please note, I did not write this particular section of coding so if an error should be thrown it may be handled somewhere as to prevent the application from crashing on the user. Side note: Yes it does work fine on my local computer although the connection must be altered.
sConnection = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\inetpub\wwwroot\kioskApplication\www\Waypoints.accdb";
Thanks in advance for all the support and help with this issue.
Usually a WEB Application stores a file based database like MS-Access in its APP_DATA folder under the root of the site where every permission is granted to the IIS Service.
Then in your connection string you refer to this location using
Connection = #"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=|DataDirectory|\Waypoints.accdb";
See Where is DataDirectory
On the server side there is no need to install anything apart from the Microsoft Database Access Engine appropriate for the bitness of your web application. (32bit or 64bit)

What is the best/simplest way to connect my Silverlight 5 web-app to a Windows Azure database?

I have a fairly simple project in progress where I create a very basic upload/download capable Silverlight 5 app to upload a user-selected file from their local machine to an Azure database. After reading up on the variety of ways to do this (WCF RIA services and others) I haven't been able to get a clear idea of how I would best implement this.
Some more information about my app would be that I envision it to be very simple, with the upload consisting of a file selection and subsequent tagging and uploading to the Azure database and the download portion consisting of a user searching for the file in a pivot-viewer like environment and then selecting and downloading the file they want. If it is relevant: the app will run in IE, Chrome, and Firefox.
How would I best connect my Silverlight app to a database set up in Windows Azure? Links to tutorials or explanations would be greatly appreciated! I'm looking for possible examples with sample code of how a Silverlight app could be written to connect and upload/download a file as well as samples/examples of what I need to setup on the Azure side in order for the app to function properly.
I think you need to use any tool which migrates your schema and connect to SQL azure database with proper server name using SQL server 2012.

Which database to use for C# ASP.NET website?

I am developing an online internal web portal (like users write tests, provide document links to study, completing a study roadmap, admin user to view ststistics, etc). It caters some 150 users. I have planned to use ASP .NET with c# in Visual Studio 2008 on windows xp. I am implementing using Forms and NOT MVC since I feel at home with forms.
I do not want to use windows authentication since each user will have many attributes related to him and so it will be easy using a database. Security is not an issue since it is being used internally only.
I have only a fair knowledge about ASP and C# and VS 2008.
Now my questions:
Can I use MS SQL server database that is built in in VS 2008?( I cannot ask for external databases)
Can I export the website totally along with the databases to IIS server running in some other computer? How?
Do I need to export databases separately or provide a database creation script like PHP?
(I have more questions. Will update once I start off).
(This is my first .net web app. so can i know where i can find login scripts, pagination, examples, and pretty much all the stuff)
edit: which to use? New website or New Webapplication?
You can pretty much use any database, but it seems from your requirements that you want to look closer towards something like SQLExpress, SQL Server Compact Edition or SQLLite.
Can I export the website totally along
with the databases to IIS server
running in some other computer? How?
Your database will be shipped along with your application if you use one of the database options that I have specified above.
Do I need to export databases
separately or provide a database
creation script like PHP?
See my comment above, the database will exist when you deploy your website to IIS. It's a physical file that will be in your APP_DATA folder.
You can use:
MySQL. The reason: It has no space or memory limit!
SQL Server or SQL CE. These are both alike. They just differ in slite functions, and also the storage!
The SQL CE allows you to have 4GB. But the SQL Server lets you have 10GB.
So it depends on your work!
Also, I wanted to point out one error in a post, that the SQL CE is present in App_Data, Correct! But the SQL Server is placed somewhere like:
C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\here_will_it_be
And yes, you can migrate it to wherever you want to place it. I mean if you want to upload it to a hosting server, you can upload it using Web Deploy! Or what ever service. When downloading you will have to repeat same process!
I hope you are doing good with your first web app! :)

Can Someone Explain VistaDB Please?

I'm seeing it pop up more and more and not really understanding the purpose of it? Can I only use it when I am developing locally on my desktop?
Or can I put a commercial site on a server with say Win2003 thats using VistaDB? Is it faster than using a SQL DB? Is it secure?
Confused...
VistaDB is a .NET alternative to the lightweight database systems offered by Microsoft: Jet (Microsoft Access), MSDE, Sql Server CE or Sql Server Express. You can use it in any .NET application where you need a database and you don't really want the overhead of having a client/server database.
VistaDB is an embedded database (some other embedded databases are SQLite and FireBird). This basically means that your database is totally "invisible" to your end users. They don't need to install a client/server database like SQL Server for instance. Deploying VistaDB is simple. All you need is the database file and a reference to the VistaDB runtime DLL within your application.
A commercial application that uses VistaDB for it's backend is Graffiti CMS.
From what I can make out of their website http://www.vistadb.net/:
You can use it for both development and commercial purposes
It's not a server, it's an assembly for your website/application
My guess is that since it's not a full featured SQL server it should be faster and lighter on the resources
Don't know how secure it is, but they state that you can put it on "medium trust" websites.
You may also want to see this StackOverflow topic about VistaDB.
Nothing is faster than SQL Server for what it does. If you think SQL Server is too slow you are probably doing something wrong. It is incredibly fast. There is no way a 100% managed engine is going to be faster than SQL Server on everything.
Lighter on resources - Yes
Easier to deploy - Yes (xcopy deployment)
Desktop database - Yes, you can use it for desktop development of applications. Some people also use it for multi user applications on a shared drive. Websites are another target where you can't install a service or don't want to pay extra for SQL Server access on the hosting account.
Security - VistaDB runs in-process with your application. There is no concept of user security since you are loading it directly.
Concurrency - Depends on your application. We support multiple processes access the same database, but some operations will still have locking issues you have to work with in your code.

SQL Express User Instance with multiple ASP.NET Sites

How can I get two separate ASP.NET sites, in this case a Web Site using Entity Framework and Web Service, to use the same local database mdf & ldf?
I looked around and I think that this kind of local DB is called a User Instance - at least they way I'm currently using it. I wasn't sure if it would work or not until I found the below info from the MSDN Library and now I'm really not sure if it will work.
User instance scenarios include:
...
Dedicated ASP.NET hosting using Windows Authentication. A single SQL Server Express instance can be hosted on an intranet. The application connects using the ASPNET Windows account, not by using impersonation. User instances should not be used for third-party or shared hosting scenarios where all applications would share the same user instance and would no longer remain isolated from each other.
Will this work right away without any extra configuration? When I try to add a DB to every successive application, I get a file in use error if anything else is using the DB which leads me to believe that I can't do it this way. However, if I stop the DB from being used, then add it, and then start it up, it seems to work fine. Does anyone have any reassurance for me that it won't be corrupted or experience any errors by using it this way?
Preferably, the mdf & ldf would be stored in the Web Site's App_Data directory (|DataDirectory|). If I do it this way, I don't think I can reliably use relative addressing for the Service unless I put it in a sub directory for the Site, is this correct?
edit: I'm using SQL Server Express because this is an assignment for school, so I pretty much have to use it. If there is a way without User Instance I'll try to do without it.
You can't use User Instance for this. This allows just one client at a time to connect to your database. When your two applications use the same credentials, you get the error you describe. When your two applications use different credentials, you essentially get two separate instances (also not what you want).
Besides, user instances are only supported on SQL Server Express. I don't know what your production environment looks like, but it probably does not run on SQL Server Express?
You should use AttachDBFilename in the connection string of your web application to point to the local database: AttachDBFilename=|DataDirectory|\MyDB.mdf.
In your web service you also use AttachDBFilename but it depends on the deployment location of the web service where to point it to.

Resources