自动完成不适用于SQL CE密码保护的数据库 [英] Auto complete doesn't work with SQL CE password protected database

查看:121
本文介绍了自动完成不适用于SQL CE密码保护的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在SQL compact 3.5数据库中添加密码时,文本框的自动完成功能停止工作(虽然我可以通过应用程序正常连接到数据库..即连接正常运行)。



所有设置都与我只为连接字符串添加密码相同。



工作自动完成:

When I add password to my SQL compact 3.5 database , the auto complete function for the textbox stops working (although I can connect normally to the database with the application.. Namely the connection is functioning properly).

All the settings are the same as I did only add the password to the connection string.

Working auto complete :

SqlCeConnection sqlcon = new SqlCeConnection(@"Data Source = TranslationTest.sdf");
        SqlCeCommand sqlcmd;
        SqlCeDataReader sqldr;
        AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection();
        
private void Form1_Load(object sender, EventArgs e)
        {

            try {
  sqlcon.Open();
  sqlcmd = new SqlCeCommand("SELECT EnglishWord,ArabicWord FROM T1", sqlcon);
  sqldr = sqlcmd.ExecuteReader();
  AutoCompleteStringCollection mycollection = new AutoCompleteStringCollection();
  while (sqldr.Read())
  {    mycollection.Add(sqldr.GetString(0));         }
  textBox1.AutoCompleteCustomSource = mycollection;
  sqlcon.Close();  }

            catch (Exception ex)
  {   MessageBox.Show(ex.Message);    }
        }





不工作(带密码):



Not working (with password) :

SqlCeConnection sqlcon = new SqlCeConnection(@"Data Source = TranslationTest.sdf;Password=778899;");
        SqlCeCommand sqlcmd;
        SqlCeDataReader sqldr;
        AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection();
        
private void Form1_Load(object sender, EventArgs e)
        {

            try {
  sqlcon.Open();
  sqlcmd = new SqlCeCommand("SELECT EnglishWord,ArabicWord FROM T1", sqlcon);
  sqldr = sqlcmd.ExecuteReader();
  AutoCompleteStringCollection mycollection = new AutoCompleteStringCollection();
  while (sqldr.Read())
  {    mycollection.Add(sqldr.GetString(0));         }
  textBox1.AutoCompleteCustomSource = mycollection;
  sqlcon.Close();  }

            catch (Exception ex)
  {   MessageBox.Show(ex.Message);    }
        }





额外费用:

- Multiline = false

- 自动完成模式=建议(尝试建议&追加..同样的问题)

- 密码添加VS2010 http://i.imgur.com/2dSNtDo.jpg

推荐答案

正如评论中所讨论的那样,在调试代码之后你能够找到问题,现在就开始工作。
As discussed in comments, after debugging the code you were able to find the issue and have it working now.


这篇关于自动完成不适用于SQL CE密码保护的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆