Here is my problem; I have a hosted and published database on godaddy servers. I have also published my website. However, when I tried to use one of visual studio's tools such as chart, or data view or any tool that wants me to specify a data source, I get the
"error 40: could not open a connection to sql server".
In most cases, I have worked around this issue by writing the code instead of using these tools on the ".cs" sections, but now I need to update my database model and I really would prefer not to write that amount of code. The connection string I choose works perfectly, it can update and gather values from database on the published website. But when I Right click on the models section and select "update model from database" the update wizard cannot access the database with the very same connection string. Like I said, this problem occurs on every tool that wants me to select a data source.
Is this a permission issue regarding visual studio or something else?
Thanks in advance.
By default, Go Daddy does not allow access to your database from anything other than your shared hosting account. We allow you direct database access from other locations if you select that option at the time you created the database. If you did not select this option when you created the database you will never be able to connect to it from a location other than your hosting account. If you did not select this option at the time you created the database and need to add that option you will have to create a new database with the option selected.
Related
I'm very new to App deployment. This is my first one actually.
I developed an app which uses a SQL Server database to store its data. I created the SQL Server database with a script. However, neither the script nor the DB itself are part of the "package" of the app. I simply installed SQL Server Management Studio with the default settings, created a new file starting with
USE [Master]
GO
CREATE DATABASE [Database]
and filled up all the details.
The app works in my machine of course, but when I Published the app and got the .Exe, it doesn't work in any other computer, of course because it's not creating a Database to go with it, and the connection string that it uses for the queries is the one that I gave it from my SQL Server instance.
So, I want to know how to actually include the database (or a way to create it) in the "installation package", and also for the program to dynamically get the necessary connection String to operate on any computer where its installed. Right now, I AM fetching the connection string from App.Config with the ConfigurationManager, but of course, the Connection String in App.config is the one that got added when I added MY instance to the project.
Any sort of guidance would be appreciated. I searched related questions but the only ones relevant had some deprecated methods. It's still not very clear to me how it would get the connection string dynamically if its not going to be the same instance.
On a semi-related matter...I noticed that my app was being executed with just double clicking on "setup.exe". Setup seems to imply that it will only install it and add an executable...it's kind of misleading to execute the app itself from the setup, isn't there another way to change that?
I know that there are some similar topic, but still I haven't found soultion.
I have create a simple ASP.NET MVC app with EF code first. I set no connectionstring, and everything works fine. I can perform CRUD actions and records are updated. But I don't know where my database is.
I am using Microsoft SQL Server Management Studio to connect to server. In Server name field I have tried to put: localhost, ., .\SQLEXPRESS, my Desktop name. These are all answears which I have found searching solutions.
Then in all cases I expand Databases/System Databases and all other Databases, but I can't find mine.
I know, that I can create an empty Database in Management Studio and set connectionstring to this DB (and it works), but I must send app to my teacher, and you know, he want to only click run, without setting up anything.
Have you got any solution?
Looked in yourproject/App_Data? Usually, the DB files are created there
I'm currently working on a school project which I almost finished. I tested it and it was working fine on my local machine. Then I uploaded it to a webserver to test it and I got an error.
Apparantly you have to configure an external MySQL server and database to get the ASP.net membership system working. (I know it's stupid but I honestly didn't know).
So now I've managed to get a free database (since it's for school purposes it doesn't matter) and I want to save the required information for the membership service in this external database.So now I have to do these three things:
1.Getting to know which columns from the local database I have to insert in the external database (e..g. username: VARCHAR(20) etc.) I need to get this info from my local database...
2 replacing the connectionstring in my web.config file to get it working with my external database.
I searched the web a lot but couldn't find the right thing to do: GETTING TO KNOW THE COLUMNSI read online it was useful to use Microsoft SQL server management. I downloaded it so I could connect to my local (automatically generated) database. I couldn't figure out how to log in. Using my machine name or just a '.' both doesn't work....edit: this is what I mean (picture) what should I do?
REPLACING THE CONNECTIONSTRING
To be honest, I don't understand the connectionstring at all...
If anyone know what to do in these two problems I would really appreciate the help!
Thanks in advance,
Elias
You seemed to ask several questions (above) so I will try to answer enough of them to get you pointed in the right direction.
First, MySQL is not the same as SQL Server. They are different/competing products. From your comments, it sounds like you need to attach a .MDF file which is a "Microsoft Database File". Instead of MySQL, you need to install SQL Express (free). SQL Management Studio will allow you to attach your .MDF file and set up permissions, etc.
Since this is for school, you can use your DB mgr to create a test account with a simple PW. It could be something simple like User: Demo, Pw: D3mooo{ (or whatever you can remember). By default Sql Server only allows you to grant permissions to accounts from your OS. To change that, you can use SSMS, right-click the server, choose Properties, security and change the "Server authentication" to "SQL Server and Windows Authentication mode". Otherwise, you could just grant permission to your IIS server's identity, which is usually some name like [machinename\IUSR] (with square-brackets).
Once that is set, you need to create a "connection string". The easiest way is to create a text file on your desktop and rename it from new text Document.txt to dsn.udl. The file extension is the trick, it must be .udl instead of .txt. If you get it right, the icon will change and you can double-click it and go through the wizard to make/test a connection string. When you are done, you can open the udl file with notepad, and it will contain a working connection string. Copy the connection string into your web.config and things should start working for your membership DB.
I would like to upgrade my Umbraco project on my localhost (and eventually my live website) from running on SQL Server CE to either SQL Server 2014 or SQL Server 2016.
The reason for the upgrade is simple: I may at some point want to manage a website that has more than 4GB of data in the database, is scalable with multiple servers, and I'd like to back things up. Otherwise I'd be lazy and leave Umbraco.sdf alone.
I have not found consistent documentation on this process anywhere. Perhaps one of you might be more experienced with SQL or Umbraco and could help out.
(Aside: For those less familiar with Umbraco, Umbraco is a Content Management System written in C# and JavaScript. There's a SQL file in here named Umbraco.sdf which contents all of the website's contents. )
I figured this out, in case anyone else gets stuck.
Here's how to do it:
Step 1: Port over your current database. With Umbraco, there's an easy way of doing this. Simply install the Export SQL Server Compact package, an addon to your Umbraco CMS. Once installed, follow the directions and generate your SQL file.
Step 2: Import the generated script to SQL Management Studio and run it in a new database. In order to do this: create a new database and give a new user permission settings to access that database (don't use your server login - you can, but it's better to create a user so you can access remotely). After that, go ahead and copy and paste your entire file (yes, that entire file) into a new query (right click the database -> run query), paste the script, and run it.
Step 3: Change the connection string. This is in your web.config. Within the XML tags of , configure something akin to this (remove the {}):
<add name="umbracoDbDSN"
connectionString="Data Source={the ip of your database};Initial Catalog={theDatabaseName};User Id={theUserId};Password={yourPassword}"
providerName="System.Data.SqlClient" />
The nice thing about this connection string is that you can edit locally, as well as on site, with the same connection string. This allows you to test code changes on your localhost, without changing the code on the website. The only thing that is linked automatically is CMS Content.
Make sure not to delete your old Umbraco connection string, in case you want to revert back to it. Simply comment that out.
Step 4: Encrypt the web.config. Clearly it's not wise to keep your database password in plaintext on your website. This MSDN on encrypting your web.config is invaluable.
There are a few things you will lose with this:
Portability of your database. Sometimes you'll want to only have a file be a database instead of a whole server. We only recommend doing this step when your site is essentially done, as configuring a SQL Server and keeping it secure is an extra challenge you shouldn't worry about.
Occasionally, images don't transport. You might have to reinput all of your images manually.
Possible security. Every time you publish your website, you may have to reencrypt the web.config manually. This can be exceedingly dangerous - so make sure your website always has the web.config encrypted, even on new publishes.
SQLCE ToolBox is the best tool for the job. Just install the extension then the steps are as follows:
In Server Explorer add the connection to your new database (Connect To Database button)
Right click on Umbraco.sdf file in in the SQLCE ToolBox and choose Migrate To SQL Server
Choose your server and export.
Modify the umbracoDbDSN connection string to point at new database.
The target database should be empty (or at least not have any conflicting table names).
It seems easiest to do it in webmatrix, have you tried that?
From: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/53818-Convert-Umbraco-SQL-CE-database-to-SQL-Express
or: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/49519-Changing-database-in-Umbraco-7
First you need setup a database in SQL Server. Once that is done, then open the Webmatrix, and in the lower left corner in the webmatrix UI you can select the databas. Then browse to the SQL Server CE database, it's located in the \App_Data folder after that a "migrate button" will appear in the upper menu options. By press that button a migrate dialogue appears asking for connection details to the SQL Server database that you have created.
I have a website, that is based on ASP.NET and using SQL Server. It is changed every year, as it's mad entirely for a yearly event, and I want to make a website history - to make user able to open the old website in a subdomain.
My problem is that every year I have to restore the database to its original state, and I can't just create another database that would hold the old data. So what I was thinking about was dumping the entire database with its structure into a file (like .MDF) and change the web.config file, so it'd use the file instead of remote database server.
But when I use SQL Server 2012 Management Studio, I can only export a .SQL file. Is it any way to do it, or my approach is wrong?
Remarks:
Performance is not a problem, the website will be used as a showcase
I don't have admin rights on the SQL Server, just data for connections
I use Visual Studio 2013 for my (web application) project
You have several options.
use the separate databases approach in a MDF file
use separate tables in the same database eg :event_2010 ... event_2014
Don't forget to then change the domain each site responds to in IIS to a subdomain like this 2013.myawesomeevent.com and so forth for each site. And keep each installation in separate folder.