当我通过移动应用程序传递此查询时,它执行但数据未保存 [英] whn I passed this query through moible application it excute but data not save
本文介绍了当我通过移动应用程序传递此查询时,它执行但数据未保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
但是当我通过移动应用程序传递此查询时,它执行但数据未保存..为什么
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]整理代码块,标记-OriginalGriff [/edit]
[edit]Code block tidied up, Tags - OriginalGriff[/edit]
推荐答案
请确保您有权访问相应的DB,并且路径正确. br/> 基于 http://www.connectionstrings.com/sql-server-2005-ce [ ^ ],此连接字符串看起来很合适.
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.
这篇关于当我通过移动应用程序传递此查询时,它执行但数据未保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文