cant connect to database and choose a database - asp.net

I installed adventure works, and I followed the instructions on this page:
How to: Create Connections to SQL Server Databases
basically nothing appears in the drop down, in step 2.
I cant even attach the database without getting an error, nor drag it to the web form.
It tells me that the database cant be attached cause it is version 705, and the server supports version 655..
Also what is teh difference between attaching the database and connecting to it?
I went to the installation center of 2008, and clicked on show installation info..I got this:
Microsoft SQL Server 2008 Setup Discovery Report
Product Instance Instance ID Feature Language Edition Version Clustered
Sql Server 2008 SQLEXPRESS MSSQL10.SQLEXPRESS Database Engine Services
1033 Express Edition 10.1.2531.0 No Sql Server
2008 SQLEXPRESS MSSQL10.SQLEXPRESS SQL Server Replication 1033 Express
Edition 10.1.2531.0 No
so I guess it is installed on my computer, but I cant access the application

You need the database to exist in an instance of SQL Server (or whatever RDBMS you so choose...but most likely, SQL Server). To do this you can do a few things: namely restore a *.bak database backup file of AdventureWorks, or you can attached the mdf and ldf files (database data and log files) to get your database online.
basically nothing appears in the drop down
Do you have an instance of SQL Server installed on your machine?
Also what is teh difference between attaching the database and connecting to it?
Attaching the database is using mdf and ldf files to get your database online ready for transactions. Connecting to the database is creating a connection between a client application and the aforementioned database. Two very different steps of the data access process.

Attaching to a database is necessary when the database file(s) are in a location other than the default location. You don't really "connect" to a specific database per se. You connect to a sql server instance which contains a list of databases on that instance (or referenced by the instance).

Related

SQL Server edition for desktop application with no network

I have been tasked with building an application for a Windows laptop that engineers can take out into the field where there is no internet access. Then, they will add data through a form and once they get back and have internet access, they can then hit a "Sync" button and send the data they collected to an external SQL Server database.
The database is SQL Server 2016 and the application is going to be a C# .NET desktop application. My question is what options are available for the database when there is no internet access? I don't really want to do Excel or Access. I really like SQL Server Compact but it seems dated. Is SQL Server Compact still relevant with the latest .NET Framework or is there something newer that everyone uses?
You could try creating a ssis package that syncs data between the offline database and live database.
The ssis package can be executed either as a sql server job that runs at intervals
or
from a stored procedure . Please find the below link on how to execute a package from stored procedure.
https://msdn.microsoft.com/en-us/library/jj820152.aspx
The stored procedure can then be called from inside the application.

SQL Server 2008 R2 Express ODBC - Not showing database

Created a new database called Test, when I try to connect to the SQL Server database via Excel I can't see the Test database which was created, I can only see master, msdb, tempdb.
I'm running SQL Server 2008 R2 Express.
I am new to Server Management, requesting some help so I can consume the data in an Excel sheet.
Got it fixed.
MS SQL was installed on a differnet domain and had windows authenticaion
When accessing from excel there was no option to choose windows authentication using a different domain.
Solution - Created a MS SQL User ID and gave access to the required database

Establishing connection to SQL Server Error

I opened my web project today and for some reason I could not gain access to my database files. I get the following exception whenever I try to add, edit or refresh my database:
A network related instance specific error occurred while establishing
a connection to SQL Server. The Server was not found or is was not
accessible. Verify that the instance name is correct and that SQL
Server is configured to allow remote connections.
I took a look at my connection string for any spelling errors and deleted my database and replaced it in the folder I had it in. I can't seem to find a fix for this so any help would be a appreciated. I am using Visual studio 2008 for this web project.
This sounds like the same problem that I had myself awhile back. My problem was that my SQL service pack 1 did not install properly so I had to install Microsoft SQL Server System CLR Types, Microsoft SQL Server 2008 Management Objects and Microsoft SQL Server 2008 Native Client. After that I could create new SQLdatasources but I could not edit the ones I had previously before my problem. I had to restart my computer in safe mode and delete my SQLEXPRESS folder then recreate the database connection in visual studios. When I finished that everything worked fine.
This is the site I got those downloads, http://blogs.cametoofar.com/post/cannot-load-file-or-assembly-microsoftsqlservermanagementsdksfc.aspx

How do I migrate a SQL MDF File to a production SQL Server? (ASP.NET)

I have an ASP.NET project that also uses a SQL MDF File. My target server is SQL 2008R2 or SQL Azure.
I would like to know what deployment options I have as I migrate from DEV to PROD. In case it matters I'm not under any regulation to maintain PII or similarly private data.
How do I move my test schema and perhaps data to production?
You can move the entire database, including the data by attaching the MDF file to the new SQL server. Otherwise you can select all objects and generate CREATE scripts to copy the schema over.
Yes, you can attach to the MDF file directly, or do a backup / restore to get it over to SQL Server 2008.
I haven't played with SQL Azure... From what little I've heard I think you might be stuck scripting the data as durilai suggested (last I heard we're not allowed to do backups / restores for SQL Azure).
In SQL Server Management tools, right click on the database and click 'Script Database As' to create an SQL script for your database. You can also do something similar at the table level if you want the data.

Data-Tier Projects and Linked Servers

I'm trying to use a Data-Tier application involving a linked server and running into an odd problem.
Here's what I have:
1) A VS2010 solution which includes a Data-Tier project.
2) The Data-Tier project targets an SQL 2008 R2 server.
3) The SQL server has a working linked server connection to an Oracle database.
4) Views within the Data-Tier project reference the linked server using OPENQUERY
The linked server connection is valid, running queries against it on the server work fine, and creating the views directly on the server works fine as well.
However, whenever I attempt to build my Data-Tier application I get the following error:
SQL03006: View: [dbo].[vwMyExampleView] has an unresolved reference to object [MyExampleLinkedServer].
Essentially the problem is that the SQL Server Database project doesn't have a way to resolve the Link to the Oracle database's tables.
I had a similar problem when trying to reference a table in a different database on the same server. In my case I was using SQL Server for both databases, and created a database project for the other database, added it to the solution for the first project, then created a reference to the second project from the first. I also used SQLCMD variables in synonyms so that I would be able to change the synonym, and all my proc and view references would not need to be updated.
I'm not sure this will work between SQL Server and Oracle since the Visual Studio database edition only supports SQL Server. (AFAIK) You may be able to find a solution by creating a .dbschema file and adding the Database reference to your SQL Server project.
More details can be found at this link:
http://msdn.microsoft.com/en-us/library/bb386242.aspx
In SQL 2012, just add new item-> Server Objects - > LinkServer, add the sp code that creates link server, you are good to go

Resources