さて、一部の人々はいくつかのコードを表示したいと思ったので、私はAlexのリンクで説明されているヘルプを使用して非常に単純なコンソールアプリケーションを作成しました。私は文字通りそのコードを取り、コンソールアプリに配置しました。アプリを起動するとすぐに機能したため、いくつかの奇跡が起こりました。メインアプリケーションで何が間違っていたのかわかりませんが、それは何かである必要があります(ええと)。コードは次のとおりです。
string MyConString = "SERVER=localhost;" +
"DATABASE=database;" +
"UID=root;" +
"PASSWORD=pass;";
System.IO.FileStream fs = new FileStream(@"D:\link\to\image.png", FileMode.Open);
System.IO.BufferedStream bf = new BufferedStream(fs);
byte[] buffer = new byte[bf.Length];
bf.Read(buffer, 0, buffer.Length);
byte[] buffer_new = buffer;
MySqlConnection connection = new MySqlConnection(MyConString);
connection.Open();
MySqlCommand command = new MySqlCommand("", connection);
command.CommandText = "insert into table(fldImage) values(@image);";
command.Parameters.AddWithValue("@image", buffer_new);
command.ExecuteNonQuery();
connection.Close();
Console.WriteLine("Task Performed!");
Console.ReadLine();