【问题标题】:datarow not showing all data数据行未显示所有数据
【发布时间】:2014-02-13 14:03:19
【问题描述】:

我的数据行有一些问题 - 所有数据都没有显示?

我在文件中有这个:

this.friendData = DatabaseClient.ReadDataTable("SELECT users.Id,users.username,users.motto,users.look,users.last_online FROM users JOIN friendships ON users.Id = friendships.user_two_id WHERE friendships.user_one_id = '" + num + "'");

然后是另一个文件:

DataRow[] DataRow_ = Session.GetUser().Data.friendData.Select("id = 8");

当我尝试这个时:

Console.WriteLine(DataRow_[0]["username"]);

它打印这个:“gassu”,但我的用户名是“TestAccount”

【问题讨论】:

    标签: c# datarow


    【解决方案1】:

    试试这个:

    Console.WriteLine(DataRow_[0]["username"]);
    

    【讨论】:

    • Wtf.. 它打印“gassu”,我的用户名是“TestAccount”,打印错误:指定的演员表无效。
    • 你得到了多少行?打印出 DataRow_ 的计数/长度。可能不止 1 行回来了???
    • 你应该发布异常,包括第 # 行和代码。这里似乎有更多代码在工作。
    • 我不明白您如何查看输出并获得转换错误...需要查看更多信息。
    • 您确定您的代码运行的数据库与您“认为”它运行的数据库相同吗?
    猜你喜欢
    • 2019-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-15
    相关资源
    最近更新 更多