[英]Please Help Me Out In Finding This 1 small error in the Code
Hello Everyone I need help with a lab assignment i am working on there is a small error the professor has put and i just cant find it. 大家好,我需要实验室任务的帮助,我正在研究教授提出的一个小错误,我无法找到它。 The lab has to do with SQL Database.
该实验室与SQL数据库有关。 The error is in the sql statement.
错误发生在sql语句中。 Please help me find it thank you.
请帮我找到它谢谢你。
// 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";
You have no space in the string between FROM
and Players
. FROM
和Players
之间的字符串中没有空格。
You would have found this easier to spot if you had printed the generated SQL to the screen to examine it. 如果您已将生成的SQL打印到屏幕上进行检查,您会发现这更容易发现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.