你是不是有点麻烦!
TBlobField(dm2.ClientDS1.FieldByName('file_content')).LoadFromFile(
OpenDialog1.FileName);
记得设置BDE 的 BlobSize为你想要得;--The end;
TBlobField(dm2.ClientDS1.FieldByName('file_content')).LoadFromFile(
OpenDialog1.FileName);
记得设置BDE 的 BlobSize为你想要得;--The end;
server端; ADOConnection1+ADOQuery1+DataSetProvider1
client端; SocketConnection1+ClientDataSet1 不行嗎??上面的錯誤是TBlobField沒声明.
db;--The end;
db;--The end;
我翻了舊帖子,發現你回答blob的問題最多. 真厲害.你能不能幫我改改代碼?
要應用什麼呀 ?
我在程序里引用了 uses udmTrainPub;
引用了 db 後問題解決了.
現在的問題是; TBlobField(dm2.ClientDS1.FieldByName('file_content')).LoadFromStream( BlobContentToString(Edit1.Text));
報錯
[Error] uUpdownfile.pas(86): Incompatible types: 'TStream' and 'String'
能不能幫我改改BlobContentToString( )函數????
我對文件操作不熟,此函數是李維書上的.謝謝...
var
dataname:String;
datafile:File;
begin
If Opendialog1.Execute then
begin
dataname:=Opendialog1.FileName ;
AssignFile(datafile,dataname); dm2.ClientDS1.CommandText := 'select * from tab_file ';
dm2.ClientDS1.Open;
dm2.ClientDS1.Edit; TBlobField(dm2.ClientDS1.FieldByName('file_content')).LoadFromFile(datafile); //報錯??????
dm2.ClientDS1.FieldByName('file_name').AsString:='公司規定';
dm2.ClientDS1.FieldByName('file_extension').AsString:='doc';
dm2.ClientDS1.FieldByName('file_date').AsString:='2002/04/22'; dm2.ClientDS1.Post;
dm2.ClientDS1.ApplyUpdates(-1);
dm2.ClientDS1.Close;
end;end;錯誤號是:
[Error] uUpdownfile.pas(68): Incompatible types: 'String' and 'file'
誰幫我改改???
而你的函数返回值却是String 。当然类型不兼容了!
你可以不用这个函数。LoadFromFile的源代码就是这个函数!--The end;
TBlobField(dm2.ClientDS1.FieldByName('file_content')).LoadFromFile(Opendialog1.FileName); //不会報錯!!!!!!!!
---The end;
您能不能幫我把 BlobContentToString( )函數改寫成返回值却是TStream.
謝謝....
ClientDS1:Field 'file_content' not found.
原因可能是沒有找到word文件.怎麼解決????
ClientDS1:Field 'file_content' not found.
原因可能是沒有找到word文件.怎麼解決????
TQuery.TTable......--The end;
我的程序是3層的,
server端; ADOConnection1+ADOQuery1+DataSetProvider1
client端; SocketConnection1+ClientDataSet1
双击你的ADOQuery1看看你是不是加入了Filed!--The end;
'file_content' 也改成大写!
下面的也是!---The end;
'file_content' --〉 FILE_CONTENT
我看看你现在的代码好吗?明天吧!
还有表结构!现在回去吧!---The end;
create table tab_file (
file_name varchar2(100) not null ,/*文件名 */
file_content blob not null ,/*文件內容 */
file_extension varchar2(10) null ,/*文件擴展名 */
file_note varchar2(80) Null,/*備註 */
file_flag varchar2(4) Null,/* 標志*/
file_drop char(1) default 'F',/*是否被刪除,T表示是,F表示否*/
modstaff varchar2(15) null ,/*最後修改或創建者工號 */
modtime date not null ,/*最後修改或創建者工號 */
primary key(file_name,modtime)
); procedure TfUpdownfile.Button2Click(Sender: TObject);
var
dataname:String;
datafile:File;
begin
If Opendialog1.Execute then
begin
dataname:=Opendialog1.FileName ;
AssignFile(datafile,dataname); dm2.ClientDS1.CommandText := 'SELECT * FROM TAB_FILE ';
dm2.ClientDS1.Open;
dm2.ClientDS1.Edit; TBlobField(dm2.ClientDS1.FieldByName('FILE_CONTENT')).LoadFromFile(dataname);
dm2.ClientDS1.FieldByName('FILE_NAME').AsString:='公司規定';
dm2.ClientDS1.FieldByName('FILE_EXTENSION').AsString:='doc';
dm2.ClientDS1.FieldByName('FILE_DATE').AsString:='2002/04/22'; dm2.ClientDS1.Post;
dm2.ClientDS1.ApplyUpdates(-1);
dm2.ClientDS1.Close;
end;end;
dm2.ClientDS1.FieldByName('FILE_DATE').AsString:='2002/04/22';
应该错了!---The end;
chongyang() 兄,謝謝你. 我現在碰到新錯'ORA--01465 此一16進位數字無效.'
begin
ShowMessage(E.Message);
end;
你先改成:
dm2.ClientDS1.FieldByName('FILE_DATE').AsDate := Date;
看看。我以前没见过这个错误,我帮你查一下!不好意思!---The end;
我解決了.但又碰到新錯'ORA--01465 此一16進位數字無效.'
您看看我的針對語句
TBlobField(dm2.ClientDS1.FieldByName('FILE_CONTENT')).LoadFromFile(dataname);
的邏輯錯誤,好嗎??(我前兩次發的貼子)
Cause: In an UPDATE statement following a SELECT FOR UPDATE, part of the ROWID contains invalid characters. ROWID must be expressed in the proper and expected format for ROWID and within quotes. Action: Enter the ROWID just as it was returned in the SELECT FOR UPDATE.研究一下!---The end;
是不是要寫一個 函數,把我word/excel文件轉化為二進製或流??