MVC 3 C# - Deployment and MYSQL Database - c#

Visual Studio 2010 - C# - MVC3
I am completely new to ASP.Net and I have been working / practising making an MVC 3 application using C#. I have practised getting an MVC application online which makes use of no databases and was successful. My hosting supports .net 4 and it was a simple process of publishing the files and uploading to my FTP. I am making a new application which makes use of a database. I have set up a data connection in the server explorer and set up all my tables and relationships. Everything is currently working as intended and I can create, edit and delete entries from the database.
I am not really sure where to start with getting this online. My hosting offers no MSSQL databases so I am presuming I can use a MYSQL database? What is the process of changing my application to use a MYSQL database which is located on my remote hosting? Also I am making use of the default accounts where users can register and login, will I have to set up a database for this too?

Your host offers mysql hosting?
you will need the mysql .net connectors.
also check this next out for the asp.net membership, mvc uses
http://dev.mysql.com/doc/refman/5.1/en/connector-net-tutorials-asp-roles.html

You can use a local DB in your APP_DATA folder or you can connect to a remote DB. Please let me know if you need additional help in either of these two areas or if I have misunderstood your question. You may also want to encrypt your web.config file to secure your DB passwords better.
From our chat:
Try this stackoverflow.com/questions/…

SQL CE supports binary deployment, meaning your hosted doesn't have to have anything installed and you get SQL support, however no stored procedure support (if that matters to you here)
In addition you can install the SQL Compact Toolbox into Visual Studio
http://sqlcetoolbox.codeplex.com/
See: http://blogs.msdn.com/b/webdev/archive/2011/01/06/how-to-bin-deploy-sql-compact-edition-4-0-and-razor-web-projects.aspx

Related

SignalR Hub with Windows Azure SQL Database

I've been a developer for a long time but I've never laid my hands on sql databases (I know, not smart of me). Anyway, I need to a create a databse on windows azure sql, design the tables and columns, and then access it using (Entity Framework , Entity Client, etc) from my ASP.NET Web Application.
I've followed this tutorial to create the database http://www.windowsazure.com/en-us/develop/net/how-to-guides/sql-database/ , I successfully created everything, just don't know how to connect to it now. Also, when I click on Manage on windows azure, I can see that the sql database (not the server) is prompting me to create a database ... inside my database which confused me a lot.
I've had a look at these, still not sure if that's what I'm looking for
http://msdn.microsoft.com/en-us/library/windowsazure/ff951633.aspx
All I need is a simply tutorial that would explain how do I connect to my database in order to design it (columns and tables), and then how do I access, read, write data from an ASP.NET Web Application
I'm using Visual Studio 2013 (I have 2012 installed as well), and can download whichever tool that would allow me to connect that dabatase.
Please help
The designer is not supported in Azure SQL..
You can instead us this link : https://SERVERNAMEGOESHERE.database.windows.net/
that contains an online database editor, or you could use a localdatabase first and then deploy through management studio
if you need your connectionstring later you can get this through windows azure portal --> your database --> Quick glance --> SHOW Connectionstring

Database to use when creating an installer for your c# application

I am creating a c# application which requires to use a database and i am also planning to create an installer for my application. I just want to ask which database would be best to use in my application and how do i install it on a user machine while installing my application through installer file.
I have thought of using MYSQL database but for that u need to have MYSQL installed.
Update
i want each user to have there own instance of database when they install the application
You do not have to ship a full database server with your application; only the redistributable runtime which your application would use to connect to the actual database server remotely. In the case of MySQL, you only need the assemblies.
Applications I wrote relied heavily on SQL Server. In order to simplify evaluations and the initial deployment, the installer would install SQL Server Express (installed as an application specific instance). This is an approach I'd recommend if your application is intended to a centralised database.
What is key to understand, especially with commercial application, is that the database engine you install may have to co-exist with existing versions of the respective database engine. That is why application specific instances was created for SQL Server Express.
The alternatives, which are embedded, are:
SQLite.net
SQL Server Compact Edition. The deployment process is well defined.
VistaDB
Embedded databases have some challenges when deployed as part of a server application. For many years, Microsoft refused to allow SQL Server Compact Edition to be used for ASP.NET applications. If the database is per user, per device, an embedded database may be perfect.
Also be aware that MySQL has license restrictions when shipped as part of commercial software (aka you're acting as an OEM, ISV or VAR).
Have a look at SQL Server Express Edition.
It's just a file which you can copy and a class library which allows to access it. And after you finished your installation you can just delete the files (or to keep them if you need them to uninstall the product).
may be u are a fresh.
MYSQL is ok ,but u are creating a C# application,i strongly advise you use mssql
because C# has a close relationship with mssql,develop more convenient.
My advice would be using SQL Azure.
But only if:
You don't need much storage (<1GB).
You don't save sensitive Data there.
Your users have an internet connection.
It's a cloud based Sql Server Database. And the Conneciton is very simple, basically you connect like to any other Database via the Connection String.
www.windowsazure.com

How to Create mysql database Dynamically in asp.net

I want create Mysql data base in asp.net (c#) as Dynamically.My task is when user login then automatically create Mysql database with username and save into my serverpath(App_Data). Actually i am not femiliar with mysql database.. please help me how to create this.....
If your purpose is being able to deploy the DB with the application just by copying it on the server (as you're implying with the reference to app_data) then MySQL is not the right database choice. You can't deploy a MySQL database just by copying the underlying files.
You probably want an in-process engine, like Sqlite, Sql Server Compact Edition or even MS Access.
If your request, however, is to use MySQL as a db for users and roles (but you understand that you will need to setup MySql and create the DB on the server before using it, as it will not be copied with your web application), then you can take a look at this question: ASP.NET Membership/Role providers for MySQL?

Can I access a remote Database through webservice? C# winforms

Lately I asked this question regarding connecting my window app to a remote database (MySQL) hosted by some free hosting site. And I got "No way" answers.
How about using a webservice? Is it possible now?
Ok (and probably assuming .NET 4.0 on you hosting provider) this should be fairly straightforward:
Yes you can access data via a webservice.
If you want to with a minimum of effort you can use WCF Data Services
Not tried this but...
Create a web application
"Build" an entity framework model for your data (see Using MySQL with Entity Framework for linking EF to MySQL)
Create the data service (which seems mostly to be a matter of doing an add new item in visual studio)
Enable access to data service resources - i.e. change some code to make sure you can see what you need.
At this point you should end up with CRUD access to your database via a fairly comprehensive web service...
Biggest challenge there will be building the EF model - you really want a local instance of the MySQL database - schema at least - to develop against.
Yes if your webservice is hosted on same server which contains mysql database. You can locally connect to mysql using webservice (which hosting providers allow for sure) and can server data using the service.

using MySQL with C#

I want to know if it is possible to use MySQL Engine without having to install WAMP Server. I'm developing an application that will require a database, so I was thinking of using MySQL instead of MS SQL or access. So I don't want to install the WAMP package yet I want to install the MySQL Engine, so if possible, please provide me with the download link for the MySQL and how to install and use (start/stop service).
You will need the runtime and the .net connector to make this happen. You also might find the workbench (gui tools to manage the server and run queries) to be helpful.
The runtime installs a service by default, which you can control on the commandline or via the windows service management console (services.msc).
This sounds to me a lot like you're thinking 'desktop application', where the MySQL database will be a simple local data store. If that's the case, MySQL is not a good choice.
MySQL is a server-class database engine. It's designed to run full time in the background as a service. This makes it overkill for a simple desktop app, and as a user I'd be mad if your simple desktop app required me to run the MySQL service.
For the kind of app I think you're building, you really want an in-process or desktop-class database. Good examples include SQLite, SQL Server Compact Edition (not Express), or even MS Access. Any of those would be a better option here than MySQL.
On the other hand, if I'm wrong and you're building a web app or an app that will be distributed to several computers that all share the same database, then MySQL is a perfectly fine choice and you should read #Femaref's answer.
If your database isn't going to be incredibly large you could go with SQL Compact. It comes with the .NET framework, and works well for smaller databases.

Categories