C#连接数据库的问题

wiie 2006-02-20 09:37:47
conStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=wordList.mdb";
conn=null;
conn=new OleDbConnection(conStr);
sqlStr="select * from wordList order by lever";
cmd=new OleDbCommand(sqlStr,conn);
da=new OleDbDataAdapter(cmd);
ds=new DataSet();
conn.Open();
da.Fill(ds,"wordList");
conn.Close();
this.mybind=this.BindingContext[ds,"wordList"];//就在这一行出错,错误信息如下
this.mybind.Position=0;


未处理的“System.ArgumentException”类型的异常出现在 system.windows.forms.dll 中。

其他信息: 无法创建字段 wordList 的子列表。
...全文
139 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
namhyuk 2006-02-20
  • 打赏
  • 举报
回复
注意到你写的SQL语句
select * from wordList order by lever
中的lever了吗?

你有可能拼写错误(应该是level)。

你把lever随便改成什么xyz, abc之类的,你会发现提示“至少一个参数未指定”这样的ArgumentException,发生在DataAdapter把数据Fill进DataSet时,而不是你指定的那一行。

110,538

社区成员

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

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

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