Click here to Skip to main content
13,152,454 members (37,921 online)
Rate this:
Please Sign up or sign in to vote.
See more:

im making Win Mobile 6 pro aplication and when i click button add should add details from textbox's to database , but when i click buton im always getting same error "The path is not valid" , i try to copy to other folders my DB but result is same, i make new project and new database to try whit new project but again same ... i dont know where im wrong the code where im using is :
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;
namespace SmartDeviceProject1
    public partial class novart2 : Form
        public novart2()
        SqlCeConnection cn = new SqlCeConnection("Data Source=C:\\Users\\USER\\Documents\\Visual Studio 2008\\Projects\\SmartDeviceProject1\\Ege.sdf");
        SqlCeCommand cmd = new SqlCeCommand();
        private void menuItem1_Click(object sender, EventArgs e)
            novart f = new novart();

        private void button1_Click(object sender, EventArgs e)
                cmd = new SqlCeCommand ("Insert into Art (mr,group_id,subgroup_id,quantity_on_stock) values('"+txtmr.Text +"','"+txtgr.Text +"','"+txtsubg.Text +"','"+txtqnt.Text +"')", cn);
                MessageBox.Show("Update Successfull to the Database");
            catch (Exception ex)
Posted 8-Nov-12 4:04am
joshrduncan2012 8-Nov-12 10:09am
You need to set the Build Action to Content in the file's properties:
gottik 8-Nov-12 12:55pm
that screw my project , thanks to god i have backup!

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I suspect it is pretty simple: Windows Mobile devices don't have disks, so they don't support "C:" as a device specifier.

I suspect that the whole path "C:\\Users\\USER\\Documents\\Visual Studio 2008\\Projects\\SmartDeviceProject1\\Ege.sdf" is invalid on the mobile device, or on the emulator of the mobile device.
gottik 8-Nov-12 12:56pm
i have alerdy try wihit Data Source = Ege.sdf
OriginalGriff 8-Nov-12 14:02pm
You probably have to find the file - have you tried opening a OpenFileDialog, locating the file, and looking at the returned path?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170924.2 | Last Updated 8 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100