c# - Store Byte[] in Access 2010 -
Simple work such as: How to store byte in Access 2010? See this for the entire day on the Web.)
I have to use the "attachment field" in Access 2010 because as far as I can see available any possible (varBinary, Image, ..) is not a field.
I tried: (ConvertImageToByte returns a byte [])
Cmd.CommandText = "Update Club Set Field 1 = @File Where Name = @Name"; Olead papermator para = new OLDP parameter ("@file", OLDB type Verbari); Paragraph Value = convertimagetoobet (logo); Cmd.ExecuteNonQuery ();
Exception: "Can not include a multi-value field to delete an update or query."
I tried:
DBEngine DBE = new DBiGin (); Database db = dbe.OpenDatabase ("database.accdb", incorrect, incorrect, ""); String command = "select * club"; Recorset RS = DB OpenerCenset (Command, RecordSet Type ANU DB Open Deinetate, 0, Lock Type ANM DBOptimic); Rs.MoveFirst (); Rs.Edit (); Recordset 2 RS2 = (RecordSet2) R. Field ["field 1"] Values; Rs2.AddNew (); Field 2 F2 = (Field2) rs2. Field ["FileData"]; F2.LoadFromFile ("file.png"); Rs2._30_Update (); Rs2.Close (); Rs._30_Update (); Rs.Close ();
This works but the file is in the first line of the table all the time and I can not understand how to get the correct line if I try to add a WHERE clause to the SELECT statement If so, get very few parameters. 2. Expected "Exception.
If anyone gets information about the story of my byte [] (or an image), please tell me to get it again!
Please do not give me the link for:
Thank you for helping friends.
You can use an OLE object field, this verb (max) Good choice.
Some notes:
"Reference: String dim dao.Recordset dim mstream ADODB as strCN dim as Microsoft ActiveX Data Object XX Library DRSQL string. Stream strSQL = "Select" Table 1 with Table "set RS = CurrentDb.OpenRecordset (strSQL) set mstream = New ADODB.Stream as mstream.Type = adTypeBinary mstream.Open mstream as. LoadFromFile "c: \ docs \ project.jpg" '' Filename & amp; Fullpath rs.AddNew rs.Fields ("Pix"). To copy back to disk, you must edit
Dim strSQL String dim cn New ADODB.Connection dim mstream New ADODB.Stream strSQL = "Select" Table 1 with Table "set as root (= CurrentDb.OpenRecordset) as can be used as (strSQL: stream). ) Mstream.Type = adTypeBinary mstream.Open mstream.Write rx pst mstream.SaveToFile "c: \ docs \ pixout.jpg" !, adSaveCreateOverWrite
Comments
Post a Comment