Showing posts with label path. Show all posts
Showing posts with label path. Show all posts

Tuesday, March 27, 2012

Accessing from desktop - path not found.

Hi,
I am trying to write a desktop application using C# and .NET that can edit an SQL Server Mobile database stored on a device. The problem is no matter how I specify the data source, I get an error the path was not found. Heres the bit of the code:

string strConn = "Data Source=" + "Mobile Device\\My Documents\\Nutricom.sdf";

SqlCeConnection connDB = new SqlCeConnection(strConn);

connDB.Open();

And the error i get is..

The path is not valid. Check the directory for the database. [ Path = Mobile Device\My Documents\Nutricom.sdf ]

Everytime it thorws an error saying the path is invalid and to check the locaiton of the database. Ive tried it without the "Mobile Device" bit of the string and still nothing. The database is definately in this location.

Any help? It's driving me insane.

Lewis

You can not do that as remote SQL CE provider you have to use to accomplish that is undocumented and to be used by VS only.

Local provider you’re probably using is incapable of accessing database on device as device file system is not accessible from desktop using standard APIs.

Due to licensing restrictions you can use local desktop provider only if one of the following is true:

1. You have VS 2005 installed on this PC.

2. You have SQL Server 2005 installed on this PC.

3. Your PC is running Windows XP Tablet edition.

Assuming licensing conditions are met, you can copy data base from device using RAPI, open it with local provider, change it and copy it back to the device.

|||Hi,

Thank you for your reply.

I am using Visual Studio 2005. Just to clarify are you saying there is no way to access the database on the device WITHOUT coping it over using RAPI? or just that it is un-documented?

I have considered using RAPI and will look into it. However I have fears it may cause syncronisation issues so I would prefer to do it the first way if possible.
|||

Using remote SQL Mobile provider is undocumented and probably would violate your license.

However, there's always a way (complexity on scale from 1 to 10):

1. Map device storage to desktop drive (8).

2. Make sure application which uses database is stopped on device while desktop is changing copy of the data base (1).

3. Add remote data access capabilities to your application (3).

4. Use 3rd party tools if available (1).

I'd go with #3 as it's simple enough and has no licensing issues.

|||Hi,
Thanks again for your kind reply.

I'm afraid one again I don't fully understand sorry . I am new to programming on the. Net platform.

Number 3 sounds good to me but I don't understand what you mean by "remote data access capabilities". Is there anywhere I can find further information on this?

For anyone else wanting to do something similar I found an excellent set of libraries from OpenNETCF.org that simplify the RAPI method of coping the database tot he device and back again. I'll use them if I can't get one of the methods above working.

Lewis
|||

Basically that means what somewhere in your code you need to listen on the TCP/IP port, accepting command and data from desktop and sending requested data back. It's not related to .Net platform, concept is known for 40 years or so.

There are some 3rd part products like that:

http://www.gui-innovations.com/html/remotesqlce.html

|||

Ah thank you very very much.

At least I understand my options now.

Thanks again for your patience and help.

Lewis

|||I Still Have Problem
I receive This error message :

"The path is not valid. Check the directory for the database."
if any one solve this problem Tell me.

Thank You
mahyar
|||

I have developed some tools that may help you:

http://www.primeworks-mobile.com

Accessing from desktop - path not found.

Hi,
I am trying to write a desktop application using C# and .NET that can edit an SQL Server Mobile database stored on a device. The problem is no matter how I specify the data source, I get an error the path was not found. Heres the bit of the code:

string strConn = "Data Source=" + "Mobile Device\\My Documents\\Nutricom.sdf";

SqlCeConnection connDB = new SqlCeConnection(strConn);

connDB.Open();

And the error i get is..

The path is not valid. Check the directory for the database. [ Path = Mobile Device\My Documents\Nutricom.sdf ]

Everytime it thorws an error saying the path is invalid and to check the locaiton of the database. Ive tried it without the "Mobile Device" bit of the string and still nothing. The database is definately in this location.

Any help? It's driving me insane.

Lewis

You can not do that as remote SQL CE provider you have to use to accomplish that is undocumented and to be used by VS only.

Local provider you’re probably using is incapable of accessing database on device as device file system is not accessible from desktop using standard APIs.

Due to licensing restrictions you can use local desktop provider only if one of the following is true:

1. You have VS 2005 installed on this PC.

2. You have SQL Server 2005 installed on this PC.

3. Your PC is running Windows XP Tablet edition.

Assuming licensing conditions are met, you can copy data base from device using RAPI, open it with local provider, change it and copy it back to the device.

|||Hi,

Thank you for your reply.

I am using Visual Studio 2005. Just to clarify are you saying there is no way to access the database on the device WITHOUT coping it over using RAPI? or just that it is un-documented?

I have considered using RAPI and will look into it. However I have fears it may cause syncronisation issues so I would prefer to do it the first way if possible.
|||

Using remote SQL Mobile provider is undocumented and probably would violate your license.

However, there's always a way (complexity on scale from 1 to 10):

1. Map device storage to desktop drive (8).

2. Make sure application which uses database is stopped on device while desktop is changing copy of the data base (1).

3. Add remote data access capabilities to your application (3).

4. Use 3rd party tools if available (1).

I'd go with #3 as it's simple enough and has no licensing issues.

|||Hi,
Thanks again for your kind reply.

I'm afraid one again I don't fully understand sorry . I am new to programming on the. Net platform.

Number 3 sounds good to me but I don't understand what you mean by "remote data access capabilities". Is there anywhere I can find further information on this?

For anyone else wanting to do something similar I found an excellent set of libraries from OpenNETCF.org that simplify the RAPI method of coping the database tot he device and back again. I'll use them if I can't get one of the methods above working.

Lewis
|||

Basically that means what somewhere in your code you need to listen on the TCP/IP port, accepting command and data from desktop and sending requested data back. It's not related to .Net platform, concept is known for 40 years or so.

There are some 3rd part products like that:

http://www.gui-innovations.com/html/remotesqlce.html

|||

Ah thank you very very much.

At least I understand my options now.

Thanks again for your patience and help.

Lewis

|||I Still Have Problem
I receive This error message :

"The path is not valid. Check the directory for the database."
if any one solve this problem Tell me.

Thank You
mahyar
|||

I have developed some tools that may help you:

http://www.primeworks-mobile.com

Thursday, March 8, 2012

Access to SQL

Does anyone know how to import an Access db to SQL.

I need to do this programmatically.

The user selects the path to the Access.mdb clicks a button and the Access data and schema are imported to a SQL db.

I can do SQL to SQL with DTS.TransferObjectsTask2 and it works perfectly but I need to be able to do Access to SQL.

Thanks

You can do it in DTS package or SSIS package just select Access database in dts and ODBC data source in SSIS package. You can also use .Net and connect to Access using ODBC set of database objects and next save results into SQL using SQL objects you can use Dataset to store your tables or just read from ODBC and save into SQL

Thanks

Access to ReportManager\bin is denied

There has been a few posts like this. I have given ASPNET access to the
folder.
Here is the long message...
Access to the path "C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportManager\bin" is denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path
"C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportManager\bin" is denied.
ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the boxes
for the desired access.
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[UnauthorizedAccessException: Access to the path "C:\Program Files\Microsoft
SQL Server\MSSQL\Reporting Services\ReportManager\bin" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalGetFileDirectoryNames(String fullPath, String
userPath, Boolean file) +229
System.IO.Directory.InternalGetDirectories(String path, String userPath,
String searchPattern) +24
System.IO.Directory.GetDirectories(String path, String searchPattern) +477
Microsoft.ReportingServices.Diagnostics.Localization.GetInstalledCultures()
Microsoft.ReportingServices.Diagnostics.Localization..cctor()
[TypeInitializationException: The type initializer for
"Microsoft.ReportingServices.Diagnostics.Localization" threw an exception.]
Microsoft.ReportingServices.Diagnostics.Localization.SetCultureFromPriorityList(String[] localeList) +0
Microsoft.ReportingServices.UI.GlobalApp.Application_BeginRequest(Object
sender, EventArgs e)
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +87I too have just installed and received the same message. Any help appreciated.
"CraigZello" wrote:
> There has been a few posts like this. I have given ASPNET access to the
> folder.
> Here is the long message...
> Access to the path "C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> Services\ReportManager\bin" is denied.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information about
> the error and where it originated in the code.
> Exception Details: System.UnauthorizedAccessException: Access to the path
> "C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> Services\ReportManager\bin" is denied.
> ASP.NET is not authorized to access the requested resource. Consider
> granting access rights to the resource to the ASP.NET request identity.
> ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
> Network Service on IIS 6) that is used if the application is not
> impersonating. If the application is impersonating via <identity
> impersonate="true"/>, the identity will be the anonymous user (typically
> IUSR_MACHINENAME) or the authenticated request user.
> To grant ASP.NET write access to a file, right-click the file in Explorer,
> choose "Properties" and select the Security tab. Click "Add" to add the
> appropriate user or group. Highlight the ASP.NET account, and check the boxes
> for the desired access.
> Source Error:
> An unhandled exception was generated during the execution of the current web
> request. Information regarding the origin and location of the exception can
> be identified using the exception stack trace below.
> Stack Trace:
>
> [UnauthorizedAccessException: Access to the path "C:\Program Files\Microsoft
> SQL Server\MSSQL\Reporting Services\ReportManager\bin" is denied.]
> System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
> System.IO.Directory.InternalGetFileDirectoryNames(String fullPath, String
> userPath, Boolean file) +229
> System.IO.Directory.InternalGetDirectories(String path, String userPath,
> String searchPattern) +24
> System.IO.Directory.GetDirectories(String path, String searchPattern) +477
> Microsoft.ReportingServices.Diagnostics.Localization.GetInstalledCultures()
> Microsoft.ReportingServices.Diagnostics.Localization..cctor()
> [TypeInitializationException: The type initializer for
> "Microsoft.ReportingServices.Diagnostics.Localization" threw an exception.]
> Microsoft.ReportingServices.Diagnostics.Localization.SetCultureFromPriorityList(String[] localeList) +0
> Microsoft.ReportingServices.UI.GlobalApp.Application_BeginRequest(Object
> sender, EventArgs e)
> System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60
> System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
> completedSynchronously) +87
>
>

Friday, February 24, 2012

Access path selection

SQL Server 2000 32 bit sp4 / Windows 2003

I have a table that has over 7.5 million rows. I have a unique clustered index (U_ORDR, D_ORDR_YR). There are 5342000 distinct occurances of U_ORDR and 24 distinct occurances of D_ORDR_YR. Database Tuning Advisor showed that there should be a nonclustered index created like (D_ORDR_YR, U_ORDR). I created this index and ran a query with show execution plan. The nonclustered index is chosen even though a bookmark lookup is required. Also the way I understand it the clustered index would be used to get to the C_ORDR column. So why is SQL Server choosing to access the nonclustered index. The plan shows a clustered index scan when I force the clustered index to be used. It also show that it would take longer to use the clustered index (85%) than to use the nonclustered/bookmark access (15%). Here is the query that I am using

declare @.OrderNumber [bigint], @.OrderYear [bigint]

select @.OrderNumber = 1753851, @.OrderYear = 02

SELECT C_ORDR

FROM CIS540T CIS540T --with (index (IX_CIS540T_Ordr_no))

WHERE CIS540T.U_ORDR = @.OrderNumber and CIS540T.D_ORDR_YR = @.OrderYear

If this is the exact query, consider just putting an index to cover:

C_ORDR, U_ORDR, D_ORDR_YR

Then you get the best of both worlds...

|||

Just to expand on Louis' suggestion in that you should specify the following order for the columns in your new index:

U_ORDR, D_ORDR_YR, C_ORDR

It sounds like the U_ORDR column offers the highest selectivity, followed by D_ORDER_YR. C_ORDR is included to form a covering index for your query.

Chris

|||My question are why is SQL Server doing an index scan when I told it that D_ORDR_YR and U_ORDR is unique. Why doesn't it use an index seek?|||

Both U_ORDR and D_ORDR_YR are defined as BIGINT in the table?

|||Both columns are defined as decimal. U_ORDR with a precision of 7 and U_ORDR_YR with a prrcision of 3. I changed the definition of @.U_ORDR and @.D_ORDR_YR to decimal the plan stayed the same. It is still doing an index scan instead of a seek.|||

Hmmm, the conversion can/will cause a scan to substituted for a scan.

try issuing:

DBCC FREEPROCCACHE

GO

first and then rerun.

|||It does seem to have been a column definition problem. I did some more swapping of data types and was able get the plan to show an index seek. Thanks for your help.

Monday, February 13, 2012

Access is denied when executing xp_cmdshell delete

hi y'all!
here i am again with another problem:

declare @.path varchar (100)
declare @.filename varchar (100)
delcare @.delete_this varchar (100)
declare @.cmd varchar (100)

set @.path = '"\\servername\shared\"'
set @.filename = 'file.txt'
set @.delete_this = @.path+@.filename
set @.cmd = 'del '+@.delete_this

exec master..xp_cmdshell @.cmd

i get this:

Access is denied.

Please Advise
Thnx.I've also heard of "net use"

Can u please enlighten me on this.

Saturday, February 11, 2012

Access denied to the access path !....ReportManager\bin

Hello
I write url Http://Servidor/Reports and present problem
Access denied to the Path C:\Archivos de programa\Microsoft SQL
Server\MSSQL\Reporting Services\ReportManager\bin".
Check the permisos and the user ASP.Net have Full acces
Thanks
HernanDid you checked the log file for the reportmanager and event log ?
"Hernan Arboleda" wrote:
> Hello
> I write url Http://Servidor/Reports and present problem
> Access denied to the Path C:\Archivos de programa\Microsoft SQL
> Server\MSSQL\Reporting Services\ReportManager\bin".
> Check the permisos and the user ASP.Net have Full acces
> Thanks
> Hernan
>
>

Thursday, February 9, 2012

Access Denied Error while Configuring

Hi,

I Installed SQL Reporting Developer edition on Windows 2000 Server.

After Installation, While Typing the Path http://localhost/Reports on the Browser, I am getting

Access to the Path "C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\Reportmanager\bin" is denied Error.

What could be the Problem?

The User your IIS is running with doesn′t have access to the binary directory for the Resporting Server bin files. So either chnage your IIS Web Server account to a service account that has access to the bin files, or grant the already used account access to the directory.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de