byte[] movieCover = null;
FileStream movieStream = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
BinaryReader movieReader = new BinaryReader(movieStream);
movieCover = movieReader.ReadBytes((int)movieStream.Length);
var movieTable = MovieTable();
var Starwars = new object[2];
Starwars[0] = "Star Wars: Episode I - The Phantom Menace";
Starwars[1] = 1999; //Also tried using a string
var sw = movieTable.Rows.Find(Starwars);
sw仍为null我的表格如下
CREATE TABLE [dbo].[Movie] (
[Name] NVARCHAR (50) NOT NULL,
[Release Year] INT NOT NULL,
[Producer] NVARCHAR (50) NULL,
[Rating] INT NULL,
[Covor] IMAGE NULL,
[Description] TEXT NULL,
PRIMARY KEY CLUSTERED ([Name] ASC, [Release Year] ASC)
);
我自己努力解决这个问题但是我已经被困了好几天了!我想做的就是手动添加图片!
答案 0 :(得分:0)
终于解决了。要拉出主键,请按here
在调用Fill方法之前,需要将DataAdapter.MissingSchemaAction设置为MissingSchemaAction.AddWithKey。
DataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;