本文介绍了错误:找不到表0.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在sql bank中有一张表,但是当我运行程序时,出现一条错误消息:找不到表0.

Hi,
I have one table in sql bank, but when i run my program gives me an error message:cannot find table 0.

for (int i = 0; i <= ds.Tables[0].Rows.Count; i++)
        {
            cmd.CommandText = @"select * from metb";
            da.SelectCommand = cmd;
            da.Fill(ds);
            string fnList = ds.Tables[0].Rows[i]["fn"].ToString();
            Label1.Text += fnList+"/n";
        }

推荐答案

cmd.CommandText = @"select * from metb";
            da.SelectCommand = cmd;
            da.Fill(ds);

        if (ds.Tables.Count > 0)
        {
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
            string fnList = ds.Tables[0].Rows[i]["fn"].ToString();
            Label1.Text += fnList+"/n";
         }
        }




这篇关于错误:找不到表0.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 19:37
查看更多