Can't connect an application to Microsoft SQL Server - sql-server-2005

A friend of mine bought an application to manage his work years ago - from a student I guess. The app was developed with DevExpress v7.2, he bought a new computer but he couldn't make it work, so he asked me to try. I created a SQL Server and restored the database, but can't connect to the SQL Server.
This is the error I get:
I noticed in the configuration file
<connectionStrings>
<add name="WindowsApplication1.My.MySettings.Base_PatientConnectionString"
connectionString="Data Source=SERVEUR\SQLEXPRESS;Initial Catalog=Base_Patient;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
but my instance was ./SQLEXPRESS
I didn't know what to do !

Related

Entity Framework cannot connect to local SQL Server

I'm using EF6 code first to connect to local instance of SQL Server,
and although I already set the connection string to local instance
it keep getting to the SQL Express instead of the full version instance.
In SQL Server Explorer it shows two : localdb/mssqlocaldb and myPC.
My connection string :
<add name="MyDatabase" providerName="System.Data.SqlClient" connectionString="Data Source=MyPC\MSSQLSERVER;Initial Catalog=MyDatabase;Integrated Security=True;MultipleActiveResultSets=True" />
Anyone could help to point out what am I doing wrong or missing here ?
Thank you

How to launch the SQL Server service in browser

I am new to SQL Server. I am doing the offline sync using SQL Server and sqlite DB. For that I followed the below tutorial SQL Server Installation. In this tutorial I am stuck on how to open the localhost service. When I run the service (localhost/AuroraSyncService.svc) in browser it shows empty.
For this I created the database AuroraSyncCn in my SQL Server Management Studio and created the new website in my IIS (internet information security).
MY coneection Strings:
<connectionStrings>
<add name="AuroraSyncCn" connectionString="Data Source=(local);Initial Catalog=SQLite-Sync.com;User ID=sa;Password=pass" providerName="System.Data.SqlClient" />
</connectionStrings>
here i tried connectionString="localhost/myservicefolde/aurorasyncservice.asmx;
Somebody help to solve this one.
From what I see your connection string should contain your database name (Initial Catalog=AuroraSyncCn).
If it's SQLExpress, instance name should probably be the same as the one mentioned by vasin1987 (server/serverinstance).
But from what I remember from ASP.NET, 'localhost' as Data Source should also be just fine.
Can you please show/write what you have in login window in MS SQL (Server name is what interest us the most):

Connect to database using sql server remotely

I have finished a program using sql server and visual studio using c# language .
I want to put the database on pc and the program that connected to that database on other PCs
I'm using this connection string in App.config :
<connectionStrings>
<add name="MWEConnectionString" connectionString ="integrated security=yes;initial catalog=MWDB;data source=.\sqlexpress"/>
</connectionStrings>
Should I change server name by pc external ip address?
and according to sql server Should I use windows authentication or what?
I don't know how to do it.
You should access the server by it's address by using Sql Server authentication.
Your connection string should look something like this:
connectionString="Data Source=192.168.0.5\SQL2008R2;Initial Catalog=MWDB;Persist Security Info=True;User ID=user;Password=password"
(this is just an example, your settings will probably be different).
Another example:
connectionString="Data Source=NAMEOFCOMPUTER\SQL2008R2;Initial Catalog=MWDB;Persist Security Info=True;User ID=user;Password=password"
for accessing the server by name.
You can generate a connection string for your application from Visual Studio. From Database Explorer -> Connect to Database
see:
http://connectionstrings.com/sql-server-2005
http://connectionstrings.com/sql-server-2005#p1

Dynamically sql connection

hi
i`m using visual basic express 2010 and SQL server 2008 R2
this is my problem
i create database in sql, then i connect to database by visual basic.
like
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections></configSections>
<connectionStrings>
<add name="WindowsApplication1.My.MySettings.BPdataConnectionString"
connectionString="Data Source=.\SQLBAC;AttachDbFilename=G:\SQLSERVER\MSSQL10_50.SQLBAC\MSSQL\DATA\BPdata.mdf;Persist Security Info=True;User ID=sa;Password=martin;Connect Timeout=30;User Instance=False"
providerName="System.Data.SqlClient" />
<add name="BPdataEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLBAC;AttachDbFilename=G:\SQLSERVER\MSSQL10_50.SQLBAC\MSSQL\DATA\BPdata.mdf;Persist Security Info=True;User ID=sa;Password=martin;Connect Timeout=30;User Instance=False;MultipleActiveResultSets=True""
providerName="System.Data.EntityClient" />
everything is working but if i will use it in other PC then database directory and SQL server name will be different...
so i need to ask program before start for server name, database name...
If you don't know the path of the database file(s), then you will need to ask the user. If you are creating the database file yourself, then you should know the location. If SQL Server is running locally, then you can use . for the source and that will resolve to the local machine.
One thing you can do in AttachDbFilename is start start off with |DataDirectory| (i.e. AttachDbFilename=|DataDirectory|\Folder1\MyDatabase.mdf) and that will resolve to the data directory of your application; with most winforms application, this is the folder that the executable is in, but some technologies (like ClickOnce) will have the data directory located elsewhere.
HTH
EDIT:
If it turns out you do need to build the connection string at runtime, there are classes in the framework that will help with that. The SQL Server version is described here at MSDN: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder.aspx

Connecting ASP.NET MVC2 App to SQL Server

So I have a database running in SQL Server Management Studio.
The server information in the top of the Object Explorer says this:
(local)(SQL Server 10.0.2531 - Scott-PC\Scott)
How do I connect my ASP.NET MVC2 App to this instance. I want a connection string in the web.config and then I want to be able to have a Database.cs class that performs all the stored proc and queries.
Data Source=Scott-PC;Initial Catalog=DatabseName;User Id=Scott;Password=password;
check here for other options
Here is a sample...
<connectionStrings>
<add name="ProductionServerEntities"
connectionString="metadata=res://*/Models.MyDBEntityModel.csdl|res://*/Models.MyDBEntityModel.ssdl|res://*/Models.MyDBEntityModel.msl;provider=System.Data.SqlClient;provider connection string="data source=MYSQLSERVER;attachdbfilename=C:\inetpub\domains\MyDomainName\App_Data\MyDB03.mdf;Database=MyDB06;integrated security=False;User ID=sa;Password=MyPassword;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>