Click here to Skip to main content
15,904,416 members
Home / Discussions / Database
   

Database

 
QuestionDrop Constraints in Oracle SQLPLUS Pin
M Riaz Bashir11-Jan-09 21:11
M Riaz Bashir11-Jan-09 21:11 
AnswerRe: Drop Constraints in Oracle SQLPLUS Pin
Wendelius12-Jan-09 2:31
mentorWendelius12-Jan-09 2:31 
QuestionReset autonumber (ID) in SQL Server Pin
Matjaz-xyz11-Jan-09 19:53
Matjaz-xyz11-Jan-09 19:53 
AnswerRe: Reset autonumber (ID) in SQL Server Pin
Matjaz-xyz11-Jan-09 20:31
Matjaz-xyz11-Jan-09 20:31 
Questionsql connection error Pin
staticv11-Jan-09 8:01
staticv11-Jan-09 8:01 
I'm connecting to SQL Server 2005 Express Edition using C++/CLI.

Here's my code, actually from the book I'm following

#include "stdafx.h"

using namespace System;
using namespace System::Data;
using namespace System::Data::SqlClient;

void main()
{
    SqlConnection^ connection = gcnew SqlConnection();

#ifdef SQLAuth
    //  SQL Server authentication
    connection->ConnectionString = 
        "User ID=sa; Password=;"
        "Data Source=(local); Initial Catalog=DCV_DB;";
#else
    //  Windows Integrated Security
    connection->ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DCV_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
#endif

	try
    {
        connection->Open();
        Console::WriteLine("We got a connection!");
    }
    catch (SqlException ^e)
    {
        Console::WriteLine("No connection the following error occurred: {0}",
            e->Message);
    }
    finally
    {
        connection->Close();
        Console::WriteLine("The connection to the database has been closed");
    }
}


I copied the connection string from the connection string property when you select the database connection in the Server Explorer in Visual Studio 2005.

And when I execute this i get the following error (exception thrown)
<br />
An error has occured while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error 40: - Could not open a connection to SQL Server)



Sorry for the too wide post Frown | :(

Top Web Hosting Providers[^]

Do, or do not. There is no 'try'.

AnswerRe: sql connection error Pin
Wendelius11-Jan-09 10:28
mentorWendelius11-Jan-09 10:28 
GeneralRe: sql connection error Pin
staticv12-Jan-09 0:23
staticv12-Jan-09 0:23 
GeneralRe: sql connection error Pin
Wendelius12-Jan-09 3:36
mentorWendelius12-Jan-09 3:36 
AnswerRe: sql connection error Pin
Henry Minute11-Jan-09 10:35
Henry Minute11-Jan-09 10:35 
QuestionInstall SQL Server on Vista Pin
George_George11-Jan-09 2:41
George_George11-Jan-09 2:41 
AnswerRe: Install SQL Server on Vista Pin
Wendelius11-Jan-09 3:05
mentorWendelius11-Jan-09 3:05 
GeneralRe: Install SQL Server on Vista Pin
George_George12-Jan-09 0:21
George_George12-Jan-09 0:21 
GeneralRe: Install SQL Server on Vista Pin
Wendelius12-Jan-09 2:26
mentorWendelius12-Jan-09 2:26 
AnswerRe: Install SQL Server on Vista Pin
Colin Angus Mackay11-Jan-09 3:20
Colin Angus Mackay11-Jan-09 3:20 
GeneralRe: Install SQL Server on Vista Pin
George_George12-Jan-09 0:24
George_George12-Jan-09 0:24 
AnswerRe: Install SQL Server on Vista Pin
Hamid_RT15-Jan-09 2:26
Hamid_RT15-Jan-09 2:26 
GeneralRe: Install SQL Server on Vista Pin
George_George15-Jan-09 18:36
George_George15-Jan-09 18:36 
Questionis there the sql syntex Limit in MS SQL? Pin
neodeaths11-Jan-09 0:44
neodeaths11-Jan-09 0:44 
AnswerRe: is there the sql syntex Limit in MS SQL? Pin
Reza Raad11-Jan-09 1:09
Reza Raad11-Jan-09 1:09 
Questionhow do i make a special sql statment filter? Pin
neodeaths10-Jan-09 22:55
neodeaths10-Jan-09 22:55 
AnswerRe: how do i make a special sql statment filter? [modified] Pin
Wendelius10-Jan-09 23:10
mentorWendelius10-Jan-09 23:10 
GeneralRe: how do i make a special sql statment filter? Pin
neodeaths11-Jan-09 0:43
neodeaths11-Jan-09 0:43 
QuestionWTL/ATL Pin
manosza10-Jan-09 21:21
manosza10-Jan-09 21:21 
AnswerRe: WTL/ATL Pin
Wendelius10-Jan-09 21:58
mentorWendelius10-Jan-09 21:58 
QuestionUpdating table based on search critea from two tables. Pin
Sunset Towers10-Jan-09 1:54
Sunset Towers10-Jan-09 1:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.