当我执行一个查询表的人口时,我只有两次出现错误。特别是,当名称字段有一些像这样的值:撇号导致查询问题
K'Ogladbach
现在撇号会导致一个问题,因为查询解释像一个新值,这个命令,这是错误的。 这是我在SQL查询结构:
string sql = @"insert into Team (name, code, shortName, squadMarketValue,
crestUrl, link_self, link_fixtures, link_players, caption)
values ('" + item.name + "', '" + item.code + "', '" +
item.shortName + "', '" + item.squadMarketValue + "', '" +
item.crestUrl + "', '" + item._links.self.href + "', '" +
item._links.fixtures.href + "', '" + item._links.players.href + "', '" +
campionato + "')";
如何可以看到每一个新值由' value '
rapresented, 因此,如果在价值有一个" ' "
这是一个问题,因为查询失败表人口。希望有一个解决方案。
使用参数化查询的另一个理由 – Steve
@HaroldFinch我想知道你真的想要做什么?你是否将SQL数据导出为CSV? – POQDavid
了解有关[Bobby Tables](http://bobby-tables.com/)SQL注入的更多信息。 – HABO