Click here to Skip to main content
12,354,763 members (61,817 online)
Rate this:
 
Please Sign up or sign in to vote.
but whn I passed this query through moible application it excute but data not save .. whyy



string path;
path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
SqlCeConnection con = new SqlCeConnection(@"Data Source=" + path + @"\AppDatabase2.sdf;Persist Security Info=False");
 string Query = "Insert into userlist(usernames,pwd) values('ff','ff')";
 con.Open();
 SqlCeCommand cmd = new SqlCeCommand(Query);
cmd.Connection = con; 
 
cmd.ExecuteNonQuery();

[edit]Code block tidied up, Tags - OriginalGriff[/edit]
Posted 24-Jun-11 1:17am
Edited 24-Jun-11 1:23am
v2
Comments
OriginalGriff 24-Jun-11 7:22am
   
Don't ask this as an add-on to a previous question, and also ask it as a full question in it's own right: you duplicate work and annoy people!

As I asked on the add-on bit: any error message? Any Exception?

1 solution

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

Solution 1

Make sure you have rights to access the appropriate DB and that the path is correct.
Based on http://www.connectionstrings.com/sql-server-2005-ce[^], this connection string looks appropriate.
  Permalink  

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 | Mobile
Web01 | 2.8.160621.1 | Last Updated 24 Jun 2011
Copyright © CodeProject, 1999-2016
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