Re: VS 2003 to VS 2005 problems
- From: "Roy Gourgi" <royng@xxxxxxxxxxxx>
- Date: Fri, 11 Nov 2005 11:21:09 -0500
Hi Nicholas,
Sorry about not being more specific. It's not a compile time error, as I
have it compiles without errors. It is a runtime error "SqlException was
unhandled" and the details are:
System.Data.SqlClient.SqlException was unhandled
Message="An error has occurred 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)"
Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060
Class=20
LineNumber=0
Number=2
Server=""
State=0
StackTrace:
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
at System.Data.SqlClient.TdsParser.Connect(Boolean&
useFailoverPartner, Boolean& failoverDemandDone, String host, String
failoverPartner, String protocol, SqlInternalConnectionTds connHandler,
Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean
integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
at
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String newPassword,
Boolean redirectedUserInstance)
at
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo, String
newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at testing.Class1.Main(String[] args) in
D:\CSRBC\SQLSample\SQLSample\Class1.cs:line 39
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Thanks
Roy
"Roy Gourgi" <royng@xxxxxxxxxxxx> wrote in message
news:S13df.30556$AX.412747@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I just installed VS 2005 Express with SQL Server and when I try to run the
> code that was working with VS 2003 is no longer working. Is it not
> backward compatible. What has changed. Below is my code.
>
> TIA
> Roy
>
>
>
> using System;
>
> using System.Data;
>
> using System.Data.SqlClient;
>
> using System.Data.SqlTypes;
>
> using System.Text;
>
> namespace testing
>
> {
>
> class Class1
>
> {
>
> [STAThread]
>
> static void Main(string[] args)
>
> {
>
> int lnSOBN=900;
>
> int lnBN1=188;
>
>
>
> string strConnection = "Server=(local);Integrated
> Security=yes;database=royDB";
>
> SqlConnection conn = new SqlConnection(strConnection);
>
> string strInsert = "INSERT INTO [tblRoy ] (SOBN, BN1) VALUES (@par0,
> @par1) ";
>
>
>
> SqlCommand cmd = new SqlCommand(strInsert , conn);
>
> SqlParameter parameter1 = new SqlParameter("@par0",SqlDbType.Int,32);
>
> SqlParameter parameter2 = new SqlParameter("@par1",SqlDbType.Int,32);
>
> parameter1.Value = lnSOBN;
>
> parameter2.Value = lnBN1;
>
> cmd.Parameters.Add(parameter1);
>
> cmd.Parameters.Add(parameter2);
>
> cmd.Connection.Open();
>
> cmd.ExecuteNonQuery();
>
> cmd.Connection.Close();
>
> }
>
> }
>
> }
>
>
.
- Prev by Date: Re: DotNet is behind where we were with VB, about a dozen years ago
- Next by Date: Re: DotNet is behind where we were with VB, about a dozen years ago
- Previous by thread: Differentiating between a CD drive and a DVD drive
- Next by thread: Re: http cookie serialization
- Index(es):
Relevant Pages
|
Loading