メッセージボックスを検討して、ユーザーに「はい」または「いいえ」と答えるように促します。XPマシンと1台のWindows7ビルドマシンで動作します。
ただし、Windows7Embeddedマシンでは機能しません。エラーメッセージはなく、MessageBoxは表示されません。createDatabase();
そこから作成されたデバッグファイルを見つけることができ、その前にmessageBoxがなくても呼び出されるため、ユーザーが[はい]ボタンをクリックしたと想定しています。
MessageBoxに必要なアセンブリ(System.Windows.Forms.dll)を見つけることができます。これは、Windows7ビルドマシンと同じ場所にあります。なぜか分かりますか?ありがとう
DialogResult result = System.Windows.Forms.MessageBox.Show(
"Do you want to update your database?\nWarning: All your data will be erased if you click Yes !",
"Update Database",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
string[] cmdLines2 = { @"C:\AndeDB\AndeDB.db is here and selected yes" };
//it will create, open and write or overwrite
File.WriteAllLines(@"C:\Temp\dbcheck2.txt", cmdLines2);
createDatabase();
}