How to run database sql script in appHarbor SQL Server - asp.net

I have successfully deployed my asp.net web form application on appHarbor and also installed SQL Server.
But I don't know how to make database as I could not find any query box of shell where I can run my schema script.

A good way to do is to download the SQL Server express 2014 that will allow the connection with add-on that you install in https://www.microsoft.com/en-us/download/details.aspx?id=42299.
with the SQL management you can grab the Host Name as server name, then use sql authentication and put your username and password.
then you can manage all your database in your site, and in Visual Studio the only thing that you need to do is provide the connection string that appHarbor gave you and copy and paste to the web.release.config.

Related

Problem publishing ASP.NET application with a SQL Server database

I've created an ASP.NET website which runs perfectly from Visual Studio. It connects to a SQL Server .mdf database file in the App_Data folder. I published the project using FTP. The live website cannot however connect to the database, as it is LocalDB, and my host uses a SQL Server (SqlException (0x80131904))
I uploaded an identical copy of the local .mdf database file from my computer to the host's SQL Server. I then tried to form a data connection with the server database from Visual Studio, however my host doesn't allow remote database access, for security reasons, resulting in error 40.
I'm using ASP.NET MVC in my application so I need access to the database to create models. My host has said "you can access SQL Server databases using ASP scripts running on your presence".
So my question is: how do I create models based on my host's SQL Server database when remote access isn't allowed?
When you're testing with Visual Studio, you should connect to the local copy of your database. When you're ready to publish your application, copy the database to the remote sql server and attach it. The copy of your application which is published should then connect to the uploaded database on that server.
That way you have one environment for testing and one for real use. There shouldn't be any need for Visual Studio to connect to the remote database.
P.S. To allow you to connect to different databases in different environments, usually you set your database connection string in the web.config file. So if you create different config transforms for each build configuration (e.g. debug and release) then visual studio will create the correct version of the config file when you do a Publish operation. See https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/web-config-transformations for info about configuration transforms.

How to know if Entity was using SQL Server or not?

I have followed through a tutorial using a "Code First" approach with Entity framework. It seems like Visual Studio was smart enough to create the database for me and setup the tables and everything based on my classes. I have a question about the database that was created.
I notice that the database was automatically set up and I could see it in my Server Explorer window in Visual Studio. In my Web.config, under the connection string, I see Data Source=(localdb)\v11.0;.... There is also a .mdf file created in a folder called App_Data.
My question is:
Was Entity framework using MS SQL Server or SQL Express for the database it has created?
If it wasn't using MS SQL Server or SQL Express, what was the database that Entity used?
I don't remember installing SQL Server or SQL Express. Does installing Visual Studio automatically install MS SQL Server or SQL Server Express?
PS: I will appreciate if you can help me to clear up my doubts. Coming from a PHP background, I'm very new to .NET and its ecosystem.
The connection string indicate that you are using SQL Server Local DB.
With Microsoft SQL Server 2012, Microsoft has introduced a feature called LocalDB which is a new edition of SQL Express. LocalDB is created specifically for developers and it is much easier to install (no service) and manage than standard editions. Developers initiate a connection by using a special connection string. It supports AttachDbFileName property, which allows you to specify a database file location.
When connecting, the server is automatically created and started, enabling the application to use the database without complex configuration tasks. This edition uses the same sqlservr.exe as the regular SQL Express and other editions of SQL Server.
http://msdn.microsoft.com/en-US/evalcenter/dn434042.aspx
http://technet.microsoft.com/en-us/library/hh212961.aspx

Simple ASP.net SQL Server database editor application

I have a website externally hosted, to which I have FTP access, however it is not a dedicated server so I can't directly connect to SQL Server. I have the database connection string from the web.config file.
I need to edit the database directly, but obviously tools like SQL Server Management Studio aren't going to work.
Is there a (free) simple database editing application available that will run directly alongside the website on the same server? I HAD one for classic asp years back but have always run dedicated servers since...
Actually you can access a database from a service like GoDaddy that is hosted with shared hosting through SQL Server. Check this link: http://support.godaddy.com/help/article/4978/connecting-remotely-to-shared-hosting-databases. GoDaddy says that you could even use the SQL Server Express edition to access your database directly and remotely but you must enable Direct Database Access when setting it up.

How can i export my SQLExpress database from Webmatrix?

I used webmatrix to write my web app. and now I need to upload my files to a host server via ftp. The database file located in App_Data folder it's name: "db.sdf.backup".
The host server uses studio manager to manage the database.
Now, my question is how do i export my database so it would work on their server?
Hey, I have the same problem, I want to export my database from webmatrix to 1and1 servers to publish my web site. Unfortunatly the migrate option of webmatrix is only available for SQL Server database and not for Mysql Database ! Do you have another idea ?
Thanks
Are you sure your database is in SQL Server Express? The file you mention (db.sdf) is a SQL Server Compact database, and WebMatrix indeed uses SQL Server Compact by default. If this is the case you need to convert your database to SQL Server "proper". WebMatrix makes it easier for you by offering the Migrate command in the SQL Server section of the ribbon.

Publishing ASP.Net Web application with SQL Server database installation

My requirement is to deploy an ASP.NET application in which I have a core library class project, service layer and a UI layer, using SQL Server database as backend.
My client needs to deploy it using some MSI or EXE, in which he / she should able to customize the installation to IIS and his SQL Server.
What I want to say, when I execute the EXE, it will ask me the basic requirement for the IIS like server name, virtual directory name, app pool etc , then automatically deploy it there. Now it should also ask the same for SQL Server database installation like server name, authentication, database name and so on....
I have tried but I can manage to deploy ASP.NET app not able to customize the SQL Server installation.
Also tell a feasible solution, as my database size is around 6GB. What will be optimized way to create a installer for that?
I once had to do something similar but my database was much smaller.
I scripted out my database into T-SQL statements for its creation from scratch and stored those in a text file.
I then wrote a .NET windows app that would prompt the user for SQL Server network location and credential information. This .NET application had the database creation SQL text file included in the executable as a resource file, and would connect to the specified SQL Server and execute the commands in the text file one by one. I was able to read the text file and parse commands out by delimiting on the keyword "GO"(linebreak).

Resources