Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
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 at 8-Nov-12 10:09am
You need to set the Build Action to Content in the file's properties:
gottik at 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 at 8-Nov-12 12:56pm
i have alerdy try wihit Data Source = Ege.sdf
OriginalGriff at 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
0 OriginalGriff 355
1 Maciej Los 180
2 Richard MacCutchan 115
3 arvind mepani 104
4 Tino Fourie 92

Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 8 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid