Results 1 to 10 of 10

Thread: [RESOLVED] The system cannot find the file specified

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Resolved [RESOLVED] The system cannot find the file specified

    I am using the SQL server compact database which is coming along with visual studio.

    Now while am compiling am geting the following error

    Code:
     A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    Please help me out.......

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: The system cannot find the file specified

    I think we've been along a similar road before. You cannot possibly be getting that error message if you're using SQL Server CE. SQL Server CE doesn't connect to a server so it cannot fail to connect to a server. That error message would only result if you were connecting to SQL Server or SQL Server Express but not SQL Server CE.

    Maybe you should show us your connection string.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: The system cannot find the file specified

    Quote Originally Posted by sanju4kk View Post
    Now while am compiling am geting the following error
    I just noticed this. Are you absolutely sure it's during compilation and not while debugging? If you just select Build from the Build menu, does that error occur then?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Re: The system cannot find the file specified

    Yes it occurs then too.
    Am not using SQL express. Am using sql server compact database which is coming along with Visual studio 2012.
    the connection string am trying is the following

    Server=localhost;initial catalog=Usermaintenance.sdf;Trusted_Connection=True

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: The system cannot find the file specified

    Either you're very confused or your VS installation is. That's not a SQL Server CE connection string. It's a SQL Server connection string, even though it's trying to refer to a SQL Server CE file rather than an actual database. It's not going to work for either. Despite the names being similar, they are two very different databases. Did you generate a typed DataSet with table adapters using the Data Source wizard or are you writing your own ADO.NET code?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Re: The system cannot find the file specified

    This is the connectionstring i have put in nhibernate config

    <session-factory>
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
    <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
    <property name="connection.connection_string">Server=Data Source=.\SQLEXPRESS;DataBase=D:\Webs\Login Page\Login Page\App_Data\UserMaintenance.sdf;</property>
    <property name="show_sql">false</property>
    <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
    <property name="current_session_context_class">managed_web</property>
    <property name="adonet.batch_size">20</property>
    <property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider</property>
    <property name="cache.use_query_cache">true</property>
    <property name="default_schema">UserMaintenance.dbo</property>
    <property name="connection.isolation">ReadCommitted</property>
    </session-factory>

    and the database is coming with .sdf extension in app_data folder

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: The system cannot find the file specified

    Quote Originally Posted by sanju4kk View Post
    This is the connectionstring i have put in nhibernate config

    <session-factory>
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
    <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
    <property name="connection.connection_string">Server=Data Source=.\SQLEXPRESS;DataBase=D:\Webs\Login Page\Login Page\App_Data\UserMaintenance.sdf;</property>
    <property name="show_sql">false</property>
    <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
    <property name="current_session_context_class">managed_web</property>
    <property name="adonet.batch_size">20</property>
    <property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider</property>
    <property name="cache.use_query_cache">true</property>
    <property name="default_schema">UserMaintenance.dbo</property>
    <property name="connection.isolation">ReadCommitted</property>
    </session-factory>

    and the database is coming with .sdf extension in app_data folder
    You may have a SQL Server CE database but everything else you're doing is for SQL Server. You're telling NHibernate to use the SQL Server provider and you're giving it a SQL Server connection string. I repeat: SQL Server and SQL Server CE are two very different things. If you want to use a SQL Server CE database then you have to tell NHibernate that, which means using the SqlServerCeDriver and not the SqlClientDriver. You may have to change the dialect too, but maybe not. You should also go to www.connectionstrings.com and learn the difference between a SQL Server connection string and a SQL Server CE connection string.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Re: The system cannot find the file specified

    I have changed the SqlClientDriver to SqlServerCeDriver and changed dialect too. now its showing another error
    "Could not create the driver from NHibernate.Driver.SqlServerCeDriver"

    and already added the reference
    system.data.sqlserverce

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Re: The system cannot find the file specified

    Thank you so much jmcilhinney

    Finally it resolved

    i put the system.data.sqlserce.dll in project bin folder

    thank u so much ))))))))))))))

  10. #10
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: [RESOLVED] The system cannot find the file specified

    All's well that ends well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width