C開かれて閉じられていませんでした...接続は、私は、接続は、接続の現在の状態を閉じていなかった ことを私に言って、そのキープが開い</p> <p>任意のヘルプしてくださいあるタイマーでこの関数を呼び出したときに、接続の現在の状態は、#
public static void Notify(string source, string query, ref OleDbConnection connection)
{
OleDbCommand command = new OleDbCommand(query, connection);
try
{
connection.Open();
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
DateTime date = DateTime.Parse(reader[0].ToString());
if (date.ToShortDateString() == DateTime.Now.ToShortDateString())
{
DateTime time = DateTime.Parse(reader[1].ToString());
if (time.ToShortTimeString() ==DateTime.Now.ToShortTimeString())
{
string notification = source + " You have " + reader[2].ToString() + " at " + (time.ToLongTimeString()).ToString();
MessageBox.Show(notification, "Reminder", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
connection.Close();
}
}
どのライン? – tchelidze
他の場所で接続を使用していますか?あなたはそれをref-parameterとして提供するので、それを使用する唯一の時間ではないかもしれません。 – Karl
エラー文法はありません。時刻が正しいとき(時刻は.nowとなります) そのメッセージを60秒以上繰り返します。 時刻が正しくないときに停止することを教えてください –