【发布时间】:2016-03-11 05:09:35
【问题描述】:
我不知道是什么导致了这个异常。我来自 VB.NET 背景,而 C# 给我带来了真正的困难。有人可以对此有所了解吗?
using (MySqlConnection connection = new MySqlConnection("server=server;uid=uid;pwd=pwd;database=db;SslMode=None"))
{
connection.Open();
MySqlCommand getCommand = connection.CreateCommand();
getCommand.Parameters.AddWithValue("@MyId", MyId);
getCommand.CommandText = "SELECT COUNT(*) FROM PhoneTag WHERE MyId = @MyId";
int userCount = (int)getCommand.ExecuteScalar();
}
【问题讨论】:
-
int userCount = (int)getCommand.ExecuteScalar();导致异常:(
标签: c# mysql xaml win-universal-app