|
|||
|
In my working project, I've large numeber of JPG,Flv.... I'd like store them in Access 2003, is it possible do that with FFish?
any idea? thank in advance; code is more appreciative |
|
|||
|
I've tried use ADO stream object, but it's seem not work!
code as follow: ....... var rs = new ActiveXObject("ADODB.Recordset"); var sm = new ActiveXObject("ADODB.Stream"); sm.Mode = 3;//adModeReadWrite 1:read only .... sm.Type = 1;//adTypeBinary 2:text sm.Open; sm.LoadFromFile("c:\\8.jpg"); sm.SaveToFile ("c:\\8a.jpg",2); // work properly rs.Open("select * from news", conn, 1, 2); rs.MoveFirst(); // trace("read...."); rs.Fields(5).Value = sm.Read(-1); // Fields(5) is an OLE field trace("update...."); rs.Update; rs.Close; rs = new ActiveXObject("ADODB.Recordset"); rs.Open("select * from news", conn, 1, 2); rs.MoveFirst(); sm.Write(rs.Fields(5).Value);// err occur! sm.SaveToFile ("c:\\8a.jpg",2); rs.Close; .................................. any idea? |
|
|||
|
oh,GOD!
it's works, err resulted from mistake! Fields(4) is OLE, Field(5) is memo! I've checked 8.jpg&8a.jpg with Acdsee! show's the same picture! strange things is that 8.jpg is 29K 8a.jpg is 57k almost double sized! I'v tested other jpgs, almost same case! Who can tell me why? |
|
|||
|
Odds!
I change code: from: sm.Write(rs.Fields(4)); to: sm.Write(rs.Fields("Photo")); finally got right file in right size! but in preview mode I got an ADO stream warning message! I woooooonder whyyyyyyyyyyyyyy???? |
|
|||
|
Sorry we've never tried this. If you want to pass binary data, please try the StringStream object.
e.g. var s = StringStream.readFromFile(name) ; field.appendChunk(s); var ss = field.GetChunk(Size); // ss is a stringstream object |
|
|||
|
I'm sorry for mistake again!
I've solved it! thanks anyway the mistake is that i've fogotten clear ADO.stream ! so it's buffered twice! just add sm.close and add a sm.open ! I'm very sorry! regards! |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|