比如我要判断某个字段的数据类型是不是money型,判断的代码该怎么写?
if qryspm3yx.Fields[j].DataType= then??
if qryspm3yx.Fields[j].DataType= then??
解决方案 »
- Tcanvas在delphi7中的哪个控件阻里找到?
- 我看书做的一个系统,怎么会有错误呢我看不出来也该不不来 帮帮忙吧
- dxDBTreeview使用方法
- 帮我写个字符串的处理函数好吗?在线等待,有答案马上结
- 如何使用Media player 9播放Realplay格式的文件
- 一个关于“文本文件”的问题——————在线等待啊 !!!!
- 关于com+ database pooling的问题
- 怎样把ComboBox中的items内容在程序运行时删除!
- 大讨论啦,上海哪有“特价”电脑书卖?
- 怎么实现Dock窗体?(急)
- 如何对已经得到查询结果的数据集(ADOQuery) 进行某个字段进行统计
- adoquery修改数据
TFieldType = (ftUnknown, ftString, ftSmallint, ftInteger, ftWord,
ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime,
ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo,
ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar, ftWideString,
ftLargeint, ftADT, ftArray, ftReference, ftDataSet, ftOraBlob, ftOraClob,
ftVariant, ftInterface, ftIDispatch, ftGuid);
SQL.Add('' + qryspm3yx.Fields[j].Text + ',')
还是报那个错,不允许将数据类型varchar转换成money
Rang: -922337203685477.5808.. 922337203685477.5807
Significant digits : 19-20
Size in bytes: 8
估计你的SQL里面是不是多了一对单引号了!
for j:=0 to qryspm3yx.FieldCount-2 do
if qryspm3yx.Fields[j].Text ='False' then
SQL.Add('0,')
else if qryspm3yx.Fields[j].Text='True' then
SQL.Add('1,')
else if qryspm3yx.Fields[j].DataType=ftCurrency then
SQL.Add('' + qryspm3yx.Fields[j].Text + ',')
else
SQL.Add('''' + qryspm3yx.Fields[j].Text + ''',');
if qryspm3yx.Fields[qryspm3yx.FieldCount-1].Text ='False' then
SQL.Add('0)')
else if qryspm3yx.Fields[qryspm3yx.FieldCount-1].Text='True' then
SQL.Add('1)')
else
SQL.Add('''' + qryspm3yx.Fields[qryspm3yx.FieldCount-1].Text + ''')');
你可以加个Memo1
然后在Add之后
Memo1.Text := qryspm3yx.SQL.Text;
然后复制Memo1上的东西出来看一下!
'01402695-7
',
'32332',
'2332',
'2006-10-6',
'323',
'23',
'23',
'23',
'',
'',
'',
'',
'',
'',
'',
'32233',
'323',
'',
'',
'',
'',
'(Memo)',
'(Memo)',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'')
其中32423是要插入的money类型
insert into 伤亡事故 values(
'01402695-7
',
'32332',
'2332',
'2006-10-6',
'323',
'23',
'23',
'23',
'',
'',
'',
'',
'',
'',
'',
'32233',
'323',
'',
'',
'',
'',
'(Memo)',
'(Memo)',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'32423',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'')
else if qryspm3yx.Fields[j].DataType=ftCurrency then
在这后面加一条ShowMessage('');看一下就知道了!
后面的语句
就是在属性页的上面了!