我做的是缴费注册系统,现在基本上可以实现各种功能了
不过不知道我改了哪里
每次运行工程都会出现这样的警告筐跳出来
PROJECT PROJECT 1.EXE RAISED EXCEPTION class evariantyre cast error with message could not convert variant of type (null)into type (string)process stopped .use step or run to continue
请帮帮小妹吧
不过不知道我改了哪里
每次运行工程都会出现这样的警告筐跳出来
PROJECT PROJECT 1.EXE RAISED EXCEPTION class evariantyre cast error with message could not convert variant of type (null)into type (string)process stopped .use step or run to continue
请帮帮小妹吧
could not convert variant of type (null)into type (string)
但是在用fieldbyname('fieldname').asstring 应该不会报错,是否其他地方有错?
可以用F8和F7跟踪,确定在哪一句错了,如果代码不是很复杂的我可以帮楼主你调试一下!把代码发给我!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ADODB, DB, DBCtrls, Buttons, ComCtrls,
DBTables;type
TForm3 = class(TForm)
Label1: TLabel;
Image1: TImage;
Label2: TLabel;
Panel1: TPanel;
Panel2: TPanel;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox4: TDBLookupComboBox;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
DataSource1: TDataSource;
Memo1: TMemo;
Memo2: TMemo;
Label9: TLabel;
Label10: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
StatusBar1: TStatusBar;
Query1: TQuery;
procedure Label1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure DBLookupComboBox1Click(Sender: TObject);
procedure DBLookupComboBox2Click(Sender: TObject);
procedure DBLookupComboBox3Click(Sender: TObject);
procedure DBLookupComboBox4Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Form3: TForm3;implementationuses Unit2;{$R *.dfm}
procedure TForm3.FormCreate(Sender: TObject);
var
i:integer;
begin
memo1.Text:='';
memo2.Text:='';
for i:=0 to query1.FieldCount-1 do
combobox1.Items.Add(query1.Fields[i].FieldName);
end;procedure TForm3.Label1Click(Sender: TObject);
begin
form2.show;form3.Hide;
end;procedure TForm3.BitBtn1Click(Sender: TObject);var
sum1:real;
s,s1,s2,s3:string;
book1:tbook;
begin
if memo1.Text='' then
begin
Application.MessageBox('请输入查询条件!','提醒',Mb_Ok+Mb_iconwarning);
end
else
begin
sum1:=0;
s1:=combobox1.Text;
s2:=combobox2.Text;
s3:=dblookupcombobox1.Text+dblookupcombobox2.Text+dblookupcombobox3.Text+dblookupcombobox4.Text;
book1:=query1.GetBook;
query1.close;
query1.SQL.Add(' where '+memo1.Text);
query1.Open;
if query1.RecordCount=0 then
begin
Application.MessageBox('没有符合条件的记录!','信息',Mb_Ok+Mb_IconInformation);
end
else
begin
query1.DisableControls;
query1.First;
while not query1.Eof do
begin
sum1:=sum1+query1.FieldValues['应缴'];
query1.Next;
end;
query1.GotoBook(book1);
query1.FreeBook(book1);
end;
str(sum1:8:2,s);
memo2.Text:='符合条件的学生共缴费'+s+'元';
end;
end;
procedure TForm3.ComboBox1Change(Sender: TObject);
begin
memo1.Text:=memo1.Text+combobox1.Text;
end;procedure TForm3.ComboBox2Change(Sender: TObject);
begin
memo1.Text:=memo1.Text+' '+combobox2.Text+' ';
end;procedure TForm3.DBLookupComboBox1Click(Sender: TObject);
begin
memo1.Text:=memo1.Text+''''+dblookupcombobox1.Text+'''';
end;procedure TForm3.DBLookupComboBox2Click(Sender: TObject);
begin
memo1.Text:=memo1.Text+''''+dblookupcombobox2.Text+'''';
end;procedure TForm3.DBLookupComboBox3Click(Sender: TObject);
begin
memo1.Text:=memo1.Text+''''+dblookupcombobox3.Text+'''';
end;procedure TForm3.DBLookupComboBox4Click(Sender: TObject);
begin
memo1.Text:=memo1.Text+''''+dblookupcombobox4.Text+'''';
end;
procedure TForm3.BitBtn2Click(Sender: TObject);
begin
memo1.Text:='';
memo2.Text:='';
combobox1.Text:='';
combobox2.Text:='';
end;end.
把源程序打包发给我!
在DELPHI中招零设为KCALCULTED计算类型
在以前得运行中从没出错,从某一天做了后面得查询统计开始才这样得。不知道可以确定是这里出错得关系吗
如果要改我要怎么改呢
ADOTable1DSDesigner9: TBCDField;
ADOTable1DSDesigner10: TBCDField;