sqllite连接字符串问题

VeRooney 2012-04-26 02:08:28

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();
}
...全文
407 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
VeRooney 2012-04-26
  • 打赏
  • 举报
回复
是的... 忘记注释了
VeRooney 2012-04-26
  • 打赏
  • 举报
回复
看错了... 多写了个 cmd.ExecuteReader();
EnForGrass 2012-04-26
  • 打赏
  • 举报
回复
cmd.ExecuteReader();//这里已经执行了,注释
SQLiteDataReader sda = cmd.ExecuteReader();//这里报错DataReader already active on this command

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧