I tried using the following code to store a file returned by openFileDialog
to an attachment field ([photoattached] is name of the field) of a table (payment) in an Access database, but I got an "invalid argument" error at runtime. Can anyone tell me what the problem is?
byte[] imageContent = File.ReadAllBytes(openFileDialog.FileName);
var command = conn.CreateCommand();
command.CommandText = @"INSERT INTO payment (photoattached.FileName,photoattached.FileData) VALUES (@Filename,@File)";
command.Parameters.AddWithValue("@FileName", openFileDialog.FileName);
command.Parameters.AddWithValue("@File",imageContent );
command.ExecuteNonQuery();