我尝试使用以下代码将openFileDialog
返回的文件存储到Access数据库中表(付款)的附件字段([photoattached]是字段名称),但我得到了“无效参数“运行时出错。谁能告诉我这是什么问题?
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();