delphi连接mysql用的是myodbc+ado控件。
我的语句是:
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select * from train where innertrainno='''+ trim(txtMS_InnerTrain.Text) +'''');
try
query1.Open ;
except
application.MessageBox('操作失败!','系统信息',mb_ok or mb_iconexclamation);
exit;
end;
当 trim(txtMS_InnerTrain.Text)有值的时候不出错,为空的时候就出错了。
project pnotify.exe raised excepton class EDatabaseError with message'Invalid field size'.process stopped.use step or run to continue.
这是怎么回事,急啊!
我的语句是:
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select * from train where innertrainno='''+ trim(txtMS_InnerTrain.Text) +'''');
try
query1.Open ;
except
application.MessageBox('操作失败!','系统信息',mb_ok or mb_iconexclamation);
exit;
end;
当 trim(txtMS_InnerTrain.Text)有值的时候不出错,为空的时候就出错了。
project pnotify.exe raised excepton class EDatabaseError with message'Invalid field size'.process stopped.use step or run to continue.
这是怎么回事,急啊!
解决方案 »
- 如在delphi程序中播放mp4格式的文件
- fastreport 的问题
- 如何把OleContainer中的WORD文档保存到数据库?又如何从数据库中读出显示在OleContainer?
- 百分大放送:提示“Could not find stored procedure 'procname'”?
- 简单问题---文件操作
- 请问下面这段代码错在哪里?
- 在线程中动态创建SOCKET和使用SOCKET过程中遇到了一些问题,希望有相关处理经验朋友给点帮助!
- 一个API问题!急!
- 用MS HTML Help Workshop 1.32创建Context-sensitive Popup帮助时总是出错?
- 如何控制打印预览的缩放处理
- 在下面这个判断一个整数是否是质数的程序中,为什么……
- help----如何判断dbgrid显示的是数据库的哪张表?
改为:
query1.sql.add('select * from train where innertrainno=:a');
query1.parameters.parameterbyname('a').value:=txtMS_InnerTrain.Text;
--------------------------
是字符串啊。
--------------------------------------------------------------------
query1.SQL.Add('select * from train where innertrainno='''+ trim(txtMS_InnerTrain.Text) +'''');
改为:
query1.sql.add('select * from train where innertrainno=:a');
query1.parameters.parameterbyname('a').value:=txtMS_InnerTrain.Text;
能不能说说是什么意思,我看不懂;我试试。
改为:
query1.sql.add('select * from train where innertrainno=:a');
query1.parameters.parameterbyname('a').value:=txtMS_InnerTrain.Text;
------------------------------------------------------------------------
试 了,不对;