日期:2014-05-18  浏览次数:20934 次

sqllite连接字符串问题
C# code

   string m_strConnectionString = "Data Source=" + AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"stations.dat";
            SQLiteConnection conn = new SQLiteConnection(m_strConnectionString);
            conn.Open();
            string sql = "select * from citys";
            SQLiteCommand cmd = new SQLiteCommand(sql,conn);
            cmd.ExecuteReader();
            SQLiteDataReader sda = cmd.ExecuteReader();//这里报错DataReader already active on this command
            while(sda.Read()) 
            {
                sda["name"].ToString();
            }



------解决方案--------------------
cmd.ExecuteReader();//这里已经执行了,注释
 SQLiteDataReader sda = cmd.ExecuteReader();//这里报错DataReader already active on this command