我正在尝试将a转换DateTime为字符串,但实际上dt该getFixtures方法中传递的变量以红色下划线.
DateTime dt = DateTime.ParseExact(Calendar.SelectedDate.Value.ToString(), "ddMMyyyy",
CultureInfo.InvariantCulture);
dt.ToString("ddMMyyyy");
fixtures.getFixtures(dt);
Run Code Online (Sandbox Code Playgroud)
错误:
无法将DateTime转换为字符串.
我究竟做错了什么?
当我对表的填充执行查询时,我只在两次出现时出错.特别是,当name字段有这样的值时:
K'Ogladbach
Run Code Online (Sandbox Code Playgroud)
现在撇号引起了一个问题,因为查询将此命令解释为新值,这是错误的.这是我在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 + "')";
Run Code Online (Sandbox Code Playgroud)
你如何才能看到每个新值都被提出来' value ',所以如果在值中有" ' "一个问题,因为查询失败了表填充.希望有一个解决方案.