Re: VS 2003 to VS 2005 problems



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();
>
> }
>
> }
>
> }
>
>


.



Relevant Pages

  • Login failed for user NT AUTHORITYNETWORK SERVICE.
    ... The login page comes up (using Membership with a db on Sql Server) and then ... Boolean redirectedUserInstance) +628 ... identity, SqlConnectionString connectionOptions, Object providerInfo, String ... newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Unable to Locate Server
    ... >> Boolean& failoverDemandDone, String host, String failoverPartner, String ... >> owningObject, SqlConnectionString connectionOptions, String newPassword, ... >>> trying to make a remote database connection while you think your ...
    (microsoft.public.sqlserver.setup)
  • asp.net sqlmembershipprovider integrated security
    ... serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 ... host, String newPassword, Boolean redirectedUserInstance, SqlConnection ... owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +349 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: asp.net sqlmembershipprovider integrated security
    ... serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 ... host, String newPassword, Boolean redirectedUserInstance, SqlConnection ... owningObject, SqlConnectionString connectionOptions, Int64 timerStart) ... owningObject, SqlConnectionString connectionOptions, String newPassword, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Help setting up SQL Express as Membership Provider (ASP.NET 2.0 beta 2)
    ... Unable to connect to SQL Server database. ... Boolean& failoverDemandDone, String host, String failoverPartner, String ... encrypt, Boolean integratedSecurity, SqlConnection owningObject, Boolean ...
    (microsoft.public.dotnet.framework.aspnet)

Loading