请帮我找出代码中的这个小错误

时间:2014-03-23 19:59:43

标签: html asp.net

大家好我需要实验室作业的帮助我正在研究教授的一个小错误,我无法找到它。该实验室与SQL数据库有关。错误发生在sql语句中。请帮我找到它谢谢你。

// Attach connection string to connection object.
con.ConnectionString = conn;

// Attach the connection object to the command object
cmd.Connection = con;

// Build sql string
String sql =
    "SELECT " +
        "Players.PlayerID, " +
        "Players.TeamID, " +
        "Players.LName, " +
        "Players.FName, " +
        "Players.PNumber, " +
        "Players.BDate " +
    "FROM" +
        "Players " +
    "ORDER BY " +
        "Players.LName Asc, " +
        "Players.FName Asc";

// Add sql to command object
cmd.CommandText = sql;

txtPlayers.Text += "***CommandText: " + cmd.CommandText + "\n";

1 个答案:

答案 0 :(得分:2)

FROMPlayers之间的字符串中没有空格。

如果您已将生成的SQL打印到屏幕上进行检查,您会发现这更容易发现。

相关问题