Filemaker のオブジェクト フィールドに画像 (.bmp) を挿入しようとしています。うまく挿入できましたが、.datファイルとして保存されます。保存するファイルの種類を指定する方法があるかどうか疑問に思っていましたか?
try
{
Bitmap tempImage = new Bitmap("C:\\temp\\black.bmp");
System.IO.MemoryStream stream = new System.IO.MemoryStream();
tempImage.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] image = stream.ToArray();
OdbcConnection connection = new OdbcConnection("DSN=Filemaker;UID=admin");
connection.Open();
OdbcCommand command = new OdbcCommand("INSERT INTO TestDatabase (LocatorNum, FileName, SampleSet, Image) VALUES (" +
"'003'" + ", " +
"'003'" + ", " +
"'003'" + ", " +
"?" + ")");
command.Connection = connection;
command.Parameters.AddWithValue("?", OdbcType.VarBinary).Value = image;
command.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}