Cannot open new .mdf file to C# project - c#-4.0

I cannot attach a new Service based database(.mdf) to a C# project that I started. It shows:
Connections to SQL Server Database file(.mdf) require sql server 2008 express to be installed and running on a local computer.The current version of the SQL express can be downloaded.
But I already have SQl Server 2008 R2 installed.I've learned that a .mdf file cannot be "just" attached if the SQl server is a full version, then do I have to create a new database to accomplish the task?Or is there anything else that I can do?

As it's mentioned by Mostafa you should go to Tools->Options->Database Tools->Data Connections->SQL Server Instance Name and blank the SQLEXPRESS in that field. actually there is no need for instance name just blank it.

Use the VS 2010 menu Tools/Connect to database and, in the dialog that opens, fill the field "Attach a database file". AFAIK it's a known problem of VS 2010.

The visual studio has a default sql server instance name to connect to. The installer sets it up to point to the SQL Server Express by default. You have to change the Tools->Options->Database Tools->Data Connections->SQL Server Instance Name to point to your installed SQL Server instance name.

Related

Enable remote connections for SQL Server 2014 Express

I have a SQL Server 2014 Express installed and I want to allow remote connections. I have read this answer, but I can't find the configuration manager installed on the system.
So my question: where can this configuration be done?
Fire up SQL Server Management Studio, and in the Object Explorer, right-click on the server node, choose Properties.
You should get a dialog something like this (it might look a little bit different in Express, but basically, that's what you should get):
Tick the checkbox Allow remote connections to this server

sharepoint 2010:cannot connect the config database

I got some problems of sharepoint 2010, here is the detail:
at first i setup sharepoint 2010 server,and the config database is hosted in a win server 2008 r2 of which ip is 192.168.10.102, but later, for some reason, i changed that ip into 192.168.10.104, and of course, problem occurs:when i open the sharepoint administrator center,it shows me "cannot connect to the config database".
how can i fix this problem? i mean,where can i change the connection string of the config database? thanks!
Connection string for SharePoint 2010 configuration database is located in the Windows Registry, the key is called dsn and it is located at:
\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure\ConfigDb

Login failed for user 'DOMAIN\user'

I'm trying to use a localDB as a local development database, but not matter what I do, I always get the exception Login failed for user 'DOMAIN\user'.
Example: right-click on data connections in the server explorer pane in vs2012. Select add connection, select Microsoft SQL Server Database File under data source and click continue. Browse to the location you want to save the database file, use windows authentication, click okay, see error.
I've tried removing all sql components from my machine and installing a fresh instance of SQL Server Express LocalDB several times to no avail.
How do I figure out which data user the database is expecting? How can I install it so that my current user can use it?
Any Help will be much appreciated.

Visual Studio 2012 SQL Database Project with SSDT

I'm starting to use Visual Studio 2012 with integrated SQL Server Data Tools and although I watched 2 of microsoft's video's on getting started with SQL Database Projects I'm still having trouble understanding how to work with them especially since I'm new to db development.
Some questions:
What is the difference between Importing a database or adding a reference to the database?
What is the difference between Server Explorer and SQL Server Object Explorer tabs? In one I can browse the database through localhost\SQLEXPRESS.dbname and the other goes through localdb\Projects. At what point are these synchronized?
How do I change the Target Database Name under the Project's properties?
1) Importing a data base creates a project that includes all of the databases artifacts. Adding a database as a reference allows a project to access the database. So if you have a SSDT project and a c# project that uses the db, the c# project gets the reference. You could choose to create the SSDT project by importing an existing db.
2) SQL Server Object Explorer is part of SSDT and allows you do perform online SQL development including creating new artifacts, adding data to tables, and executing scripts.
3) To change the target database name for debugging purposed (where the database goes when you build/debug) change the target connection string in the debug tab of the properties menu of the project.
I've found this link to be quite helpful.
There are many differences between SQL Server Object Explorer (SSOX) and Server Explorer. Here's a couple:
SSOX allows you to launch refactoring operations
SSOX provides a logical view of your source code in Solution Explorer
In short, SSOX targets database development whereas Server Explorer is (I think) a generic hierarchical viewer for many server types.
Regards
Jamiet

InstallShield 2012: Need to switch between sql scripts (sql server & oracle) based on property

The web applications I am installing can run against either a SQL Server or Oracle database. I need to be able to determine which database the user has (client is suggesting a property file) and then dynamically tell InstallShield whichSQL script to run, I know I can figure out how to determine which database is installed. My question is how do I configure the Feature/Component and tell InstallShield which script to use.
I don't have any Oracle servers available to me nor do I have the Oracle Instant Client. If I did, it seems I'd use a Basic MSI project included in InstallShield to build an Oracle Instant Client MSI and add it to my installer as a setup prerequisite. Kind of odd but I guess they couldn't get IBM / Oracle to play nicely.
So let's say I had all of that. I'd create a Sql connection that supported both MS and ORA SQL and build it. I'd run the installer with logging on and use the SQLLogin dialog to browse to a SQL instance and an Oracle Instance.
Then I'd look at that logfile and see if there's any evidence of the built-in InstallShield SQL custom actions setting a property that indicates the type and/or version of database server that it connected to. Hopefully something will surface because I didn't find anything in the documentation.
Once I figured that out, I'd use the property in a conditional expression so that the SQL scripts only ran on the type of database server they were intended.

Resources