Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
but whn I passed this query through moible application it excute but data not save .. whyy



C#
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
Updated 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

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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900