|
-
May 15th, 2013, 02:51 AM
#1
Thread Starter
Addicted Member
[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.......
-
May 15th, 2013, 05:16 AM
#2
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.
-
May 15th, 2013, 05:24 AM
#3
Re: The system cannot find the file specified
 Originally Posted by sanju4kk
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?
-
May 15th, 2013, 05:50 AM
#4
Thread Starter
Addicted Member
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
-
May 15th, 2013, 06:10 AM
#5
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?
-
May 15th, 2013, 06:31 AM
#6
Thread Starter
Addicted Member
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
-
May 15th, 2013, 06:52 AM
#7
Re: The system cannot find the file specified
 Originally Posted by sanju4kk
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.
-
May 15th, 2013, 07:07 AM
#8
Thread Starter
Addicted Member
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
-
May 15th, 2013, 07:30 AM
#9
Thread Starter
Addicted Member
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 ))))))))))))))
-
May 15th, 2013, 08:48 AM
#10
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|