Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server CE / January 2008

Tip: Looking for answers? Try searching our database.

Sqlserverce class not working when VB.Net application is running from     network drive

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
srikumari.maddela@gmail.com - 07 Jan 2008 15:18 GMT
I have VB.net application which has SQL Server Compact Edition 2005
Database as backend. In VB.net coding i am using Sqlserverce classes
to connect this database. It works well when I run the application in
local drives. But its not working when I run the application from
network drives. I tried with strong names and security policies. Still
not working. Can anybody help me to resolve this Issue. Its urgent
Plzzzzzzzzz.

Thanks
Srikumari.
Ginny Caughey [MVP] - 07 Jan 2008 15:34 GMT
How do you know it is not working? Do you get any error message? Is it
possible that the database is already in use when you attempt to connect to
it on the network drive? Is the application running from the same location
as the database file or on a different computer?

Signature

Ginny Caughey
Device Application Development MVP

>I have VB.net application which has SQL Server Compact Edition 2005
> Database as backend. In VB.net coding i am using Sqlserverce classes
[quoted text clipped - 6 lines]
> Thanks
> Srikumari.
srikumari.maddela@gmail.com - 08 Jan 2008 15:35 GMT
On Jan 7, 10:34 am, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@wasteworks.com> wrote:
> How do you know it is not working? Do you get any error message? Is it
> possible that the database is already in use when you attempt to connect to
[quoted text clipped - 21 lines]
>
> - Show quoted text -

Hi
Thanks for your reply.  It gives the error
"Application has encountered a problem and needs to close.  We are
sorry for the inconvenience."
1st I couldnt locate where the error exists. So I commented the code
line by line and tried to find out which line of code is causing the
problem. I gor the error at SqlCeConnection varible declaration
itself. Same case with all the Sqlce classes. I already added the
necessary references also. I commented the  database connection code.
I tried only with variable declaration. This itself causing the error.
Please help me to resolve this issue.

Thnaks,
Srikumari.
Ginny Caughey [MVP] - 08 Jan 2008 15:59 GMT
If you don't already have a try...catch block around the SqlCeConnection
code, add that and see if you can trap exactly what the error is. Use the
debugger to see if there is any InnerException your should be aware of.

The only thing that is generally different about a network drive location
for a SSC database is that only a single connection is supported at a time.
Lack of adequate rights can also be an issue. If you're running the app from
a local machine where your app works if the sdf file is also local, then I
assume all the DLLs you need are present. But if you're actually running the
app from a network machine, then an incomplete SSC installation could also
be an issue.

Signature

Ginny Caughey
Device Application Development MVP

On Jan 7, 10:34 am, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@wasteworks.com> wrote:
> How do you know it is not working? Do you get any error message? Is it
> possible that the database is already in use when you attempt to connect
[quoted text clipped - 22 lines]
>
> - Show quoted text -

Hi
Thanks for your reply.  It gives the error
"Application has encountered a problem and needs to close.  We are
sorry for the inconvenience."
1st I couldnt locate where the error exists. So I commented the code
line by line and tried to find out which line of code is causing the
problem. I gor the error at SqlCeConnection varible declaration
itself. Same case with all the Sqlce classes. I already added the
necessary references also. I commented the  database connection code.
I tried only with variable declaration. This itself causing the error.
Please help me to resolve this issue.

Thnaks,
Srikumari.
srikumari.maddela@gmail.com - 08 Jan 2008 19:21 GMT
On Jan 8, 10:59 am, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@wasteworks.com> wrote:
> If you don't already have a try...catch block around the SqlCeConnection
> code, add that and see if you can trap exactly what the error is. Use the
[quoted text clipped - 61 lines]
>
> - Show quoted text -

Thanks Ginny

I tried with the try catch block. Still the error is same.
Let me explain you what I did.
On System A I installed my application. Database is also on System A's
folder where the executable is. If I run the application from System
A , it works fine and it connects to the database also.
Now I mapped the System A's folder where the application exists on to
System B. (Both the systems are in network and sharing permission is
also there.)
Now I am running the application from System B. Then that error
"Application has encountered a problem and needs to close.  We are
sorry for the inconvenience."
exists.

In the code if I dont use any Sqlserverce classess then it works fine
in System B also. The error exists only when I use Sqlserverce
classess.
But those are needed to connect to the database.

Help me to solve this plz.

Thnaks,
Srikumari.
Ginny Caughey [MVP] - 08 Jan 2008 19:26 GMT
Instead of mapping the drive to point to a different machine, does it work
if you just copy everything to that machine and run it there? I really can't
tell what the problem is from your description, but I'm guessing it could be
a sharing violation.

Signature

Ginny Caughey
Device Application Development MVP

On Jan 8, 10:59 am, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@wasteworks.com> wrote:
> If you don't already have a try...catch block around the SqlCeConnection
> code, add that and see if you can trap exactly what the error is. Use the
[quoted text clipped - 65 lines]
>
> - Show quoted text -

Thanks Ginny

I tried with the try catch block. Still the error is same.
Let me explain you what I did.
On System A I installed my application. Database is also on System A's
folder where the executable is. If I run the application from System
A , it works fine and it connects to the database also.
Now I mapped the System A's folder where the application exists on to
System B. (Both the systems are in network and sharing permission is
also there.)
Now I am running the application from System B. Then that error
"Application has encountered a problem and needs to close.  We are
sorry for the inconvenience."
exists.

In the code if I dont use any Sqlserverce classess then it works fine
in System B also. The error exists only when I use Sqlserverce
classess.
But those are needed to connect to the database.

Help me to solve this plz.

Thnaks,
Srikumari.
srikumari.maddela@gmail.com - 08 Jan 2008 19:55 GMT
On Jan 8, 2:26 pm, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@wasteworks.com> wrote:
> Instead of mapping the drive to point to a different machine, does it work
> if you just copy everything to that machine and run it there? I really can't
[quoted text clipped - 107 lines]
>
> - Show quoted text -

Ya it works fine If I copy everything onto System B and run it.
Sharing permissions are there for both the systems. (I am able to
access all other folders bewteen the 2 systems. So there is no sharing
problem)
In my case the application needs to be run from the network drive  as
per the client requirement. They have nearly 50 systems in network and
they want to install application on to only one system and run it from
all other systems. So this mapping the drive is needed.
one more thing, I installed the necessary software Dot Net Compact
Framework and SqlServer Compact Edition 2005 on to System B.
In some articles I read that this is bcoz of some Security issues and
they asked to set some Full Trust options which I did. Even then the
same error I got.
In some articles they asked to try by creating strong name which I
tried and got the same error.

Thanks
Srikumari.
Ginny Caughey [MVP] - 08 Jan 2008 20:05 GMT
If only one process is running the app *at a time* on the mapped drive, I
would have though that might work. The (known) issue is that if more than
one app attempts to connect to a sdf file on a network share, the first app
that connections opens that file with an exclusive handle so no other apps
can access it.

Signature

Ginny Caughey
Device Application Development MVP

On Jan 8, 2:26 pm, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@wasteworks.com> wrote:
> Instead of mapping the drive to point to a different machine, does it work
> if you just copy everything to that machine and run it there? I really
[quoted text clipped - 116 lines]
>
> - Show quoted text -

Ya it works fine If I copy everything onto System B and run it.
Sharing permissions are there for both the systems. (I am able to
access all other folders bewteen the 2 systems. So there is no sharing
problem)
In my case the application needs to be run from the network drive  as
per the client requirement. They have nearly 50 systems in network and
they want to install application on to only one system and run it from
all other systems. So this mapping the drive is needed.
one more thing, I installed the necessary software Dot Net Compact
Framework and SqlServer Compact Edition 2005 on to System B.
In some articles I read that this is bcoz of some Security issues and
they asked to set some Full Trust options which I did. Even then the
same error I got.
In some articles they asked to try by creating strong name which I
tried and got the same error.

Thanks
Srikumari.
srikumari.maddela@gmail.com - 08 Jan 2008 20:22 GMT
On Jan 8, 3:05 pm, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@wasteworks.com> wrote:
> If only one process is running the app *at a time* on the mapped drive, I
> would have though that might work. The (known) issue is that if more than
[quoted text clipped - 153 lines]
>
> - Show quoted text -

Only one process is running the application at a time on the mapped
drive.
There is only one attempt at a time to connect the database. If one
attemt work fine then I will try with multiple attempts.
I have this error with one attempt at a time.
Norman Yuan - 22 Jan 2008 14:48 GMT
Your problem has nothing to do with SQL Server CE. It is the .NET code
access security (CAS) issue.

By default, .NET treat any .NET code loaded from outside of the running
computer (such as from the Internet, from network share) as unsafe. YOu need
to configure the running computer to allow code loaded from outside the box
to run. In your case, you could either give your entire intranet certain
trust (Full Trust would be simple, but a bit too much), or give a specific
network share full trust, so that all .NET code loaded froom that location
could run. IN your developing computer, you could go to Control
Panel->Administrative Tool->MS .NET 1.x/2.0 Configuration applet to
configure .NET code access security. However, with .NET 2.0, that applet
only avaialble if the computer has .NET 2.0 SDK. You need to use CASPOL.exe
command line tool. Google CASPOL.exe, you would get hundreds or thousands
links.

A bit study on CAS would solve your problem.

HTH.

>I have VB.net application which has SQL Server Compact Edition 2005
> Database as backend. In VB.net coding i am using Sqlserverce classes
[quoted text clipped - 6 lines]
> Thanks
> Srikumari.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.