procedure TMDI_daoru.e_btnClick(Sender: TObject);
var
m_keydate:String;
m_amount:integer;
m_factoryid:integer;
m_productid:integer;
m_keyuniid:String;
s_message:String;
publicKey:array[0..1000] of char;
m_message:array[0..300] of char;
m_serier:array[0..1000] of byte; b_tag:boolean;
x:TGuid;
F1: File;
fSize:Integer;
NumRead: Integer;
i:Integer;
Buf: array[0..128] of char;
begin
if e_file.Text = '' then
begin
Application.MessageBox('请选择要导入的文件!','提示',mb_ok);
select_btn.SetFocus;
exit;
end;
//打开文件
AssignFile(F1, e_file.Text);
// Record size set to 1
Reset(F1, 1); //Attain all bytes of F1
fSize := FileSize(F1); //读起时间
BlockRead(F1, Buf, 20, NumRead);
showmessage('文件时间:'+buf);
m_keydate := Buf;
//showmessage(FormatDateTime('yyyy-mm-dd',StrToDateTime(trim(m_keydate)))); //读起系列号的数量
BlockRead(F1, Buf, 20, NumRead);
//showmessage(buf);
i:= StrToIntDef(buf,-1);
if i = -1 then
begin
MessageDlg('文件中包含错误的数据类型!', mtWarning, [mbOk], 0);
select_btn.SetFocus;
exit;
end;
m_amount := StrToInt(trim(buf)); //读起厂商标识
BlockRead(F1, Buf, 20, NumRead);
showmessage('文件总长度:'+inttostr(fSize)); i:= StrToIntDef(buf,-1);
if i = -1 then
begin
MessageDlg('文件中包含错误的数据类型!', mtWarning, [mbOk], 0);
select_btn.SetFocus;
exit;
end;
m_factoryid := StrToInt(trim(buf)); //读起产品ID号
BlockRead(F1, Buf, 20, NumRead);
i:= StrToIntDef(buf,-1);
if i = -1 then
begin
MessageDlg('文件中包含错误的数据类型!', mtWarning, [mbOk], 0);
exit;
end;
m_productid := StrToInt(trim(buf)); //读起密码唯一标志
BlockRead(F1, Buf, 37, NumRead);
m_keyuniid := trim(buf); //读起公钥
BlockRead(F1,publicKey,276,NumRead); //读起验证信息
BlockRead(F1,m_message,300,NumRead);
s_message := m_message; //读起系列号
//BlockRead(F1,m_serier,fSize-693,NumRead); b_tag := p_form.p_frm.table_p.Locate('factoryid',varArrayOf([m_factoryid]),[loPartialKey]); if (b_tag = true) then
begin
messagedlg('不能插入厂商ID号相同的记录,请检查输入是否正确!',mtInformation,
[mbOk], 0);
exit;
end; //把相关信息插入表smpp_factory_name中
p_form.p_frm.Table_p.Append;
p_form.p_frm.table_p.FieldValues['factoryid'] := m_factoryid;
p_form.p_frm.table_p.FieldValues['factoryname'] := '贵州移动通信公司';
p_form.p_frm.table_p.FieldValues['regdate'] := StrToDate('2002-12-16');
p_form.p_frm.table_p.Post; showmessage('密码唯一标志:'+(m_keyuniid));
showmessage('公钥:'+publicKey);
//把相关信息插入表smpp_factory_key中
Table1.Append;
table1.FieldValues['factorykeyid'] := m_keyuniid;
table1.FieldValues['factorykey'] := '13123';
table1.FieldValues['regdate'] := StrToDate('2002-12-16');
table1.Post; showmessage('验证信息:'+m_message);
//把相关信息插入表smpp_product中
Table2.Append;
table2.FieldValues['factoryid'] := m_factoryid;
table2.FieldValues['productid'] := m_productid;
table2.FieldValues['factorykeyid'] := '123-123-123';
table2.FieldValues['productmessage'] := '1231231';
table2.FieldValues['regdate'] := StrToDate('2002-12-16');
table2.Post; //关闭文件
CloseFile(F1);
end;错误:他总是报'factorykeyid'这个字段没有找到,在数据库中我已经设置了其是否为ROWGUID为否,还是不行?????
var
m_keydate:String;
m_amount:integer;
m_factoryid:integer;
m_productid:integer;
m_keyuniid:String;
s_message:String;
publicKey:array[0..1000] of char;
m_message:array[0..300] of char;
m_serier:array[0..1000] of byte; b_tag:boolean;
x:TGuid;
F1: File;
fSize:Integer;
NumRead: Integer;
i:Integer;
Buf: array[0..128] of char;
begin
if e_file.Text = '' then
begin
Application.MessageBox('请选择要导入的文件!','提示',mb_ok);
select_btn.SetFocus;
exit;
end;
//打开文件
AssignFile(F1, e_file.Text);
// Record size set to 1
Reset(F1, 1); //Attain all bytes of F1
fSize := FileSize(F1); //读起时间
BlockRead(F1, Buf, 20, NumRead);
showmessage('文件时间:'+buf);
m_keydate := Buf;
//showmessage(FormatDateTime('yyyy-mm-dd',StrToDateTime(trim(m_keydate)))); //读起系列号的数量
BlockRead(F1, Buf, 20, NumRead);
//showmessage(buf);
i:= StrToIntDef(buf,-1);
if i = -1 then
begin
MessageDlg('文件中包含错误的数据类型!', mtWarning, [mbOk], 0);
select_btn.SetFocus;
exit;
end;
m_amount := StrToInt(trim(buf)); //读起厂商标识
BlockRead(F1, Buf, 20, NumRead);
showmessage('文件总长度:'+inttostr(fSize)); i:= StrToIntDef(buf,-1);
if i = -1 then
begin
MessageDlg('文件中包含错误的数据类型!', mtWarning, [mbOk], 0);
select_btn.SetFocus;
exit;
end;
m_factoryid := StrToInt(trim(buf)); //读起产品ID号
BlockRead(F1, Buf, 20, NumRead);
i:= StrToIntDef(buf,-1);
if i = -1 then
begin
MessageDlg('文件中包含错误的数据类型!', mtWarning, [mbOk], 0);
exit;
end;
m_productid := StrToInt(trim(buf)); //读起密码唯一标志
BlockRead(F1, Buf, 37, NumRead);
m_keyuniid := trim(buf); //读起公钥
BlockRead(F1,publicKey,276,NumRead); //读起验证信息
BlockRead(F1,m_message,300,NumRead);
s_message := m_message; //读起系列号
//BlockRead(F1,m_serier,fSize-693,NumRead); b_tag := p_form.p_frm.table_p.Locate('factoryid',varArrayOf([m_factoryid]),[loPartialKey]); if (b_tag = true) then
begin
messagedlg('不能插入厂商ID号相同的记录,请检查输入是否正确!',mtInformation,
[mbOk], 0);
exit;
end; //把相关信息插入表smpp_factory_name中
p_form.p_frm.Table_p.Append;
p_form.p_frm.table_p.FieldValues['factoryid'] := m_factoryid;
p_form.p_frm.table_p.FieldValues['factoryname'] := '贵州移动通信公司';
p_form.p_frm.table_p.FieldValues['regdate'] := StrToDate('2002-12-16');
p_form.p_frm.table_p.Post; showmessage('密码唯一标志:'+(m_keyuniid));
showmessage('公钥:'+publicKey);
//把相关信息插入表smpp_factory_key中
Table1.Append;
table1.FieldValues['factorykeyid'] := m_keyuniid;
table1.FieldValues['factorykey'] := '13123';
table1.FieldValues['regdate'] := StrToDate('2002-12-16');
table1.Post; showmessage('验证信息:'+m_message);
//把相关信息插入表smpp_product中
Table2.Append;
table2.FieldValues['factoryid'] := m_factoryid;
table2.FieldValues['productid'] := m_productid;
table2.FieldValues['factorykeyid'] := '123-123-123';
table2.FieldValues['productmessage'] := '1231231';
table2.FieldValues['regdate'] := StrToDate('2002-12-16');
table2.Post; //关闭文件
CloseFile(F1);
end;错误:他总是报'factorykeyid'这个字段没有找到,在数据库中我已经设置了其是否为ROWGUID为否,还是不行?????
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货