The path is not valid. Check the directory for the database.
Hi My program in design time preview data and work with Sql Data Base (sdf) activesync connected device. but when run the program This message appear: The path is not valid. Check the directory for the database. help me
I can populate the datagrid control on the mobile device from the SQL db on my PC, but I cannot update the data as described in the tutorial. I keep receiving the error: The path is not valid. Check the directory for the database.
You should know that I have directory "med302 sql mobile" defined as a share. I can access this folder on any machine on my network by entering "\\mycomputername\med302 sql mobile" in Explorer.
Imports
System.Data.SqlServerCE
Imports
System.Data.Common
Imports
System.Data
Public
Class Form1
Dim strPath As String = \\mycomputername\med302 sql mobile\SQLMobile.sdf
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ItemDataTableAdapter.Fill(Me.SQLMobileDataSet1.ItemData)
End Sub
Private Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click
Dim cn As New SqlCeConnection("Data Source=" + strPath)
cn.Open()
Dim sSQL As String = "INSERT INTO ItemData(ItemName, Qty) VALUES ('New Item', 10)"
Dim cmd As New SqlCeCommand(sSQL, cn)
yes I have a VS2005 designer session connected to a SQL Mobile database which is on a mobile device connected through ActiveSync. I try every connection string you can imagine until disconnect PDA and close activesync. then start program with "\Mobile Device\My Documents\Northwind.sdf" connection string and receive same error:
The path is not valid. Check the directory for the database.
what does it mean program not understand "\Mobile Device\My Documents\Northwind.sdf"
what is going on here is that you have a VS2005 designer session connected to a SQL Mobile database which is on a mobile device connected through ActiveSync. As a result, the connection string to the database which is automatically generated with the bindingsource is a special connection string that only works from within VS2005 and it begins with DataSource = Mobile Device\.....
You need to search for and replace this connection string in your project code with a valid path on device. So in other words, your connection string should change from
Data Source = \Mobile Device\My Documents\Northwind.sdf
to
Data Source = \My Documents\Northwind.sdf
as an example of what I'm talking about.
Note that you cannot build a Windows Forms (desktop app) that uses this special connection string format (\Mobile Device) to connect directly through activesync - this syntax is only valid within VS2005 and SS2005 management studio.
Darren
The path is not valid. Check the directory for the database.
The path is not valid. Check the directory for the database.
Buck_Danny
Hi! I am having the exact same problem!
I am using the following tutorial to build my first mobile app:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp
I can populate the datagrid control on the mobile device from the SQL db on my PC, but I cannot update the data as described in the tutorial. I keep receiving the error: The path is not valid. Check the directory for the database.
You should know that I have directory "med302 sql mobile" defined as a share. I can access this folder on any machine on my network by entering "\\mycomputername\med302 sql mobile" in Explorer.
Imports
System.Data.SqlServerCEImports
System.Data.CommonImports
System.DataPublic
Class Form1 Dim strPath As String = \\mycomputername\med302 sql mobile\SQLMobile.sdf Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.ItemDataTableAdapter.Fill(Me.SQLMobileDataSet1.ItemData) End Sub Private Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click Dim cn As New SqlCeConnection("Data Source=" + strPath)cn.Open()
Dim sSQL As String = "INSERT INTO ItemData(ItemName, Qty) VALUES ('New Item', 10)" Dim cmd As New SqlCeCommand(sSQL, cn)cmd.CommandType = Text
cmd.ExecuteNonQuery()
cn.Close()
End SubAny help would be appreciated!
Thanks!
- Mikeymac
calebb
Can you try removing the first back-slash in your conn string.
That is it should be like: Mobile Device\Temp\Northwind.sdf
Thanks,
Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Ev, Microsoft Corporation
Sahildagar
I try every connection string you can imagine until disconnect PDA and close activesync.
then start program with "\Mobile Device\My Documents\Northwind.sdf" connection string
and receive same error:
The path is not valid. Check the directory for the database.
what does it mean
program not understand "\Mobile Device\My Documents\Northwind.sdf"
vargasbo
what is going on here is that you have a VS2005 designer session connected to a SQL Mobile database which is on a mobile device connected through ActiveSync. As a result, the connection string to the database which is automatically generated with the bindingsource is a special connection string that only works from within VS2005 and it begins with DataSource = Mobile Device\.....
You need to search for and replace this connection string in your project code with a valid path on device. So in other words, your connection string should change from
Data Source = \Mobile Device\My Documents\Northwind.sdf
to
Data Source = \My Documents\Northwind.sdf
as an example of what I'm talking about.
Note that you cannot build a Windows Forms (desktop app) that uses this special connection string format (\Mobile Device) to connect directly through activesync - this syntax is only valid within VS2005 and SS2005 management studio.
Darren