Which version of SQL Server supports.Net framework 4.5? - sql-server

I am new to .NET technology and I am using Visual Studio 2012 and .net framework 4.5. I tried SQL Server 2008 but I'm unable to connect to it with server name . and .\SQLEXPRESS.
Which version of SQL Server should I install for database access and please provide the link for same?

VS.NET 2012 ships with SQL Server 2012 Express LocalDb. If you use LocalDb and its file is located in App_Data\DatabaseFileName.mdf then you could connect using
<add name="ConnectionStringName"
providerName="System.Data.SqlClient"
connectionString="Data Source=(LocalDB)\v11.0;AttachDbFileName=|DataDirectory|\DatabaseFileName.mdf;InitialCatalog=DatabaseName;Integrated Security=True" />
To see what database is in use you can either from VS.NET or using SQL Server Management Studio
If you use other database, e.g. SQL Server 2008, you need to make sure that
name of the server and the SQL Server instance
server is up and running
You can use ".", "(local)", or "localhost" in place of the server name to specify the local computer, but you need to make sure that server is there.
Open SQL Server Management Studio, Connect to Server and see the name of the server and its authentication type. If it is a Windows Authentication you can use Integrated Security=True in the connection string.
Example:
using System.Data.SqlClient;
protected void Page_Load(object sender, EventArgs e)
{
string connectionString = #"Data Source=\SQLEXPRESS;Initial Catalog=DBNAME_HERE;Integrated Security=True";
using (SqlConnection objSqlConnection = new SqlConnection(connectionString))
{
try {
objSqlConnection.Open();
objSqlConnection.Close();
Response.Write("Connection is successfull");
} catch (Exception ex) {
Response.Write("Error : " + ex.Message.ToString());
}
}
}
Reed more here.

Microsoft SQL Server 2012 Express have the following limitations:
Maximum database size 10GB
Maximum usage of Ram 1GB
Single physical CPU
No SQL Server Agent (job scheduler)
Profiler tool is not included
Also, your connection string should be something like this:
Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;
Trusted_Connection=Yes;

Related

Upgrading SQL Management from Express 2012 to Enterprise 2016

I am migrating my Webappserver from SQL2012Express to SQL2016Enterprise.
for this I have installed a Windows server 2016 with IIS10 my current IIS db connection String is
"data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
this is on Windows 2008 and IIS 7 with SQL 2012 Express.
Now on the new webappserver my source is no longer SQLexpress since the SQL is enterprise not express. my instance name was SQL2012 I changed it to Sql2016 in my Software's web.config and IIS as well I am not able to connect my software to the Database.
Here is what my current Db String is on the current webappserver.
My SQL management Studio is
On the New Server My ISS db connection string is the same which is express?
and my SQL Studio properties are
My connection string in my MVC app web.config file is
I hope I am giving you enough information to help me on this challenge I am facing.
This is my first time migrating SQL server and I am sure I have create the instance correctly.
my connection String to the site on IIS is
data source=.\SQL2016;Integrated Security=True;App=Worldwide;Initial Catalog=Worldwide
Any Help is very, very appreciate it.
Thank you.

Error 25 when creating a service-based database/SQL server database inside Visual Studio

Using Visual Studio Community 2015 and SQL Server Enterprise 2014.
I have been trying to find a solution for this since yesterday. I'm getting this error message:
Network-related or instance-specific error. Error 25 - Connection string is not valid.
Here is my connection string.
<connectionStrings>
<add name="LocalSql" connectionString="Data Source=SERVER;User ID=Administrator;Password=***********;User Instance=False"/>
I can connect to the server from Visual Studio (through Data Connections and SQL Server Object Explorer). I can also connect to the server using SQL Server Mgmt Console.
Remote connections allowed. In Visual Studio Tool>Data Connections: Sql Server instance name is MSSQLSERVER.
I even enabled all transport protocols. TCP, Named Pipes, Shared Memory. All client protocols are also enabled.
SQL Server is running alongside Visual Studio when I attempt to create the service-based database/Sql server database from Solution Explorer.
Has anyone got this working with this setup? Visual Studio 2015 and SQL Server 2014 are both running from the same computer. Or is this one of those broken software interfaces that we should just ignore?
As always, your time is much appreciated.
In your connection string do specify the SQL Server instance name if it's a named instance rather a default instance. Also, specify the initial database name to connect to like below along with the Provider Name
connectionString="Data Source=SERVER\instance_name;Database=Sample;User ID=Administrator;Password=***********;User Instance=False"; Provider="System.Data.SqlClient"/>

Cannot connect to SQL Server 2012 (connection string issue?)

I have been searching through SO and found a connection string that seems to be what I need.
However, it does not work.
I use SQL Server 2012 Express and I need my application to connect (with no credentials). I am using the following con.string:
Server=(localdb)\\SQLEXPRESS;Database=MyDB;Trusted_Connection=Yes;
However, the server does not respond.
You need to either use the proper SQL Server Express - then use this connection string:
server=(local)\\SQLEXPRESS;Database=MyDB;Integrated Security=SSPI;
(use just (local) - not (localdb))
or you use LocalDB (which is a "run-on-demand" version of SQL Server Express), in that case, use:
server=(localdb)\\v11.0;Database=MyDB;Integrated Security=SSPI;
The difference:
SQL Server Express proper is a server-based solution, which is installed and runs as a Windows service all the time
SQL Server Express LocalDB is a run-on-demand version of SQL Server Express, which only gets started up when you need it (e.g. in debugging inside Visual Studio 2012/2013)

Migrate from SQL server 2008 to 2012

I have successfully migrated all my databases from 2008 to 2012 and mapped the user to the specific databases.
My problem being is 2008 expired (hence why I got 2012) and I was using a web service to call/edit data in the tables.
When I run a web service function it just times out which suggests to me that it is still trying to talk to 2008.
I am using -
using System.Data.OleDb;
using System.Data.SqlClient;
with connection -
OleDbConnection objConnection = null;
OleDbCommand objCmd = null;
String strConnection, strSQL;
strConnection = "Provider=sqloledb;Data Source=.;Initial Catalog=NSN;User Id=userID;Password=password;Connect Timeout=300";
My question being, how can I tell the web service to point at SQL server 2012 now that I have migrated all the databases?
If your SQL Server 2008 has expired why dont you then remove the access for the user mentioned in your connection string to the SQL 2008 Db or best make it offline. If the application fails then you know that it was still pointing to SQL2008.
Try to change your connection string to the following:
strConnection = "Provider=sqloledb;Data Source=.\<INSTANCENAME>;Initial Catalog=NSN;User Id=userID;Password=password;Connect Timeout=300";
Where is the name of your SQL Server 2012 instance. It should be the same as you type in the 'Server name' in management studio login dialog.
The problem is that you are trying to connect to the default instance which is your SQL Server 2008 installation.

vb.net connect to sql server 2008 - login failed for user' '

I'm currently upgrading my sql server from 2005 to 2008 enterprise server. I used VB to connect to the database. It worked fine in the previous version of sql, but when upgrading it seems doesn't recognize my connection string.
Below is my connection string:
myConnection = New SqlConnection("server=RAVY-PC\RAVY;uid=;pwd=;database=CIEDC");
myConnection.Open();
Where Ravy-PC\RAVY is my server name at the sql server login dialogue box. And I used the windows authentication mode.
Any help would be appreciated. Thanks guy for viewing....
Try this connection string:
Server=RAVY-PC\RAVY;Database=CIEDC;Trusted_Connection=True;

Resources