小编Chr*_*llo的帖子

c# SqlDataReader throwing syntax error, but the command runs fine in SQL Server?

I'm getting a syntax error from my SQL command shown in the code below. The error is happening on the ExecuteReader line, saying

Incorrect syntax near the keyword 'JOIN'.'

I have no idea why it's throwing a syntax error, the command works perfectly fine in SQL Server. Here's the code:

private void button1_Click(object sender, EventArgs e)
{
    SqlCommand sqlcomViewSmashRoster;
    SqlDataReader dataReader;
    String strSql, strOutput ="";

    strSql = "SELECT Roster.CharacterName, Roster.TotalTournamentsParticiaped, Roster.TotalWins, Roster.TotalLosses, Roster.Championships, Roster.InjuriesCaused, Roster.Injured" +
             "FROM Roster" +
             "INNER …
Run Code Online (Sandbox Code Playgroud)

c# sql-server sqldatareader syntax-error executereader

0
推荐指数
1
解决办法
50
查看次数