これは簡単なことではないかもしれませんが、ADO.netで見たすべての例は、ほとんどの場合、常に「更新」の前に「塗りつぶし」があります。実際には、1000のBLOBを持つ可能性のあるデータセットを埋めたいとは思わないので、テーブルに追加(挿入)したいだけです。更新に必要なFillの例として、ここでMSFTのWebサイトからのサンプルコードは(私たちは似た何かをやっている)だ:?ADO.NETで更新する前に塗りつぶしを実行する必要がありますか?
SqlConnection con = new SqlConnection("Server=Darkover;uid=<username>;pwd=<strong password>;database=northwind");
SqlDataAdapter da = new SqlDataAdapter("Select * From MyImages", con);
SqlCommandBuilder MyCB = new SqlCommandBuilder(da); // What does this even do?
DataSet ds = new DataSet("MyImages");
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
FileStream fs = new FileStream(@"C:\winnt\Gone Fishing.BMP", FileMode.OpenOrCreate, FileAccess.Read);
byte[] MyData= new byte[fs.Length];
fs.Read(MyData, 0, System.Convert.ToInt32(fs.Length));
fs.Close();
da.Fill(ds,"MyImages"); // are they really filling a dataset with all those images???
DataRow myRow;
myRow=ds.Tables["MyImages"].NewRow();
myRow["Description"] = "This would be description text";
myRow["imgField"] = MyData;
ds.Tables["MyImages"].Rows.Add(myRow);
da.Update(ds, "MyImages");
con.Close();