Click here to Skip to main content
15,891,033 members
Home / Discussions / Database
   

Database

 
GeneralRe: Check Condition Pin
SreejithAchutan7-Dec-07 17:45
SreejithAchutan7-Dec-07 17:45 
GeneralRe: Check Condition Pin
Colin Angus Mackay8-Dec-07 0:43
Colin Angus Mackay8-Dec-07 0:43 
Generalneed solution for converting the varchar value to int ** Pin
VenkataRamana.Gali6-Dec-07 18:58
VenkataRamana.Gali6-Dec-07 18:58 
GeneralRe: need solution for converting the varchar value to int ** Pin
Krish - KP6-Dec-07 19:33
Krish - KP6-Dec-07 19:33 
GeneralRe: need solution for converting the varchar value to int ** Pin
VenkataRamana.Gali6-Dec-07 19:46
VenkataRamana.Gali6-Dec-07 19:46 
GeneralRe: need solution for converting the varchar value to int ** Pin
Paddy Boyd7-Dec-07 0:39
Paddy Boyd7-Dec-07 0:39 
GeneralRe: need solution for converting the varchar value to int ** Pin
Krish - KP7-Dec-07 3:13
Krish - KP7-Dec-07 3:13 
QuestionProblem while accessing the sqlserver2005 in c# Pin
mohanallam6-Dec-07 17:36
mohanallam6-Dec-07 17:36 
Hi friends

I am facing a problem while accessing database sqlserver 2005 from command prompt.
Here i am giving my code. I don't have any compilation errors,
But runtime errors as follows....

Unhandled Exception: System.Data.SqlClient.SqlException: An error has occurred w
hile establishing a connection to the server. When connecting to SQL Server 200
5, this failure may be caused by the fact that under the default settings SQL Se
rver does not allow remote connections. (provider: Named Pipes Provider, error:
40 - Could not open a connection to SQL Server)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception

my code is :

using System;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Demonstrates how to work with SqlConnection objects
/// </summary>
class SqlConnectionDemo
{
static void Main()
{
// 1. Instantiate the connection

string strConnection = "server=localhost; Trusted_Connection=yes; timeout=120";
SqlConnection Conn = new SqlConnection(strConnection);

SqlDataReader rdr = null;

try
{
// 2. Open the connection
if (Conn.State == ConnectionState.Closed)
{
Conn.Open();
}


// 3. Pass the connection to a command object
SqlCommand cmd = new SqlCommand("select * from Customers", Conn);


// 4. Use the connection


// get query results
rdr = cmd.ExecuteReader();

// print the CustomerID of each record
while (rdr.Read())
{
Console.WriteLine(rdr[0]);
}
}
finally
{
// close the reader
if (rdr != null)
{
rdr.Close();
}

// 5. Close the connection
if (Conn != null)
{
Conn.Close();
}
}
}
}
Note: I am executing my program at cmd prompt.

Help please...........
GeneralRe: Problem while accessing the sqlserver2005 in c# Pin
pmarfleet6-Dec-07 21:08
pmarfleet6-Dec-07 21:08 
GeneralRe: Problem while accessing the sqlserver2005 in c# Pin
suyuan19846-Dec-07 23:09
suyuan19846-Dec-07 23:09 
QuestionDifference between SQL-Agent and SQL-QA when executing a SP Pin
asrs636-Dec-07 15:01
asrs636-Dec-07 15:01 
GeneralRe: Difference between SQL-Agent and SQL-QA when executing a SP Pin
Marek Grzenkowicz6-Dec-07 21:35
Marek Grzenkowicz6-Dec-07 21:35 
Questionlocal sql server database not updating Pin
webster.ut6-Dec-07 9:44
webster.ut6-Dec-07 9:44 
GeneralRe: local sql server database not updating Pin
Chris Meech6-Dec-07 10:02
Chris Meech6-Dec-07 10:02 
GeneralRe: local sql server database not updating Pin
Pete O'Hanlon6-Dec-07 10:04
mvePete O'Hanlon6-Dec-07 10:04 
GeneralMSDTC - Remote accessing SQL Server 2005 from a desktop application Pin
N a v a n e e t h6-Dec-07 5:31
N a v a n e e t h6-Dec-07 5:31 
GeneralRe: MSDTC - Remote accessing SQL Server 2005 from a desktop application Pin
GuyThiebaut6-Dec-07 9:55
professionalGuyThiebaut6-Dec-07 9:55 
GeneralRe: MSDTC - Remote accessing SQL Server 2005 from a desktop application Pin
Tobias Schoenig6-Dec-07 21:33
Tobias Schoenig6-Dec-07 21:33 
Generalcounting null rows Pin
Xmen Real 6-Dec-07 4:36
professional Xmen Real 6-Dec-07 4:36 
GeneralRe: counting null rows Pin
Colin Angus Mackay6-Dec-07 6:01
Colin Angus Mackay6-Dec-07 6:01 
GeneralRe: counting null rows Pin
GuyThiebaut6-Dec-07 9:25
professionalGuyThiebaut6-Dec-07 9:25 
GeneralGenerate Sqlscript for Table using Query Analyzer Pin
Satish - Developer6-Dec-07 0:37
Satish - Developer6-Dec-07 0:37 
GeneralRe: Generate Sqlscript for Table using Query Analyzer Pin
Rob Graham6-Dec-07 3:57
Rob Graham6-Dec-07 3:57 
GeneralRe: Generate Sqlscript for Table using Query Analyzer Pin
GuyThiebaut6-Dec-07 10:01
professionalGuyThiebaut6-Dec-07 10:01 
QuestionHow to change default CLR Schema? Pin
DotNetWWW6-Dec-07 0:10
DotNetWWW6-Dec-07 0:10 

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.