有三个表,结构完全一样.
建数据表SQL语句如下: (另两个表分别是wj010a,wj020a)
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[wj0101010a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[wj0101010a]
GOCREATE TABLE [dbo].[wj0101010a] (
[rp_time] [datetime] NOT NULL ,
[rp_sw] [float] NULL ,
[rp_ll] [float] NULL ,
[rp_sl] [float] NULL ,
[rp_tb] [smallint] NULL 
) ON [PRIMARY]
GO我要在delphi7中实现这个功能: 每隔5分钟,随机向这三个表的某一个表中写入数据: 
rp_time取当前系统时间,其他字段取随机数就可以了.我现在用的是ADO连接sql server数据库, 但写入数据时总是不成功. 
另贴:http://community.csdn.net/Expert/topic/3336/3336262.xml?temp=.337536我没时间再等再试了,请高手帮忙做一个demo程序给我算了,要多少分你说了算.
请发到[email protected]

解决方案 »

  1.   

    问题在这里
    http://community.csdn.net/Expert/topic/3336/3336262.xml?temp=.337536
      

  2.   

    with query1 do
    begin
    sql.Clear;
    SQL.Add('insert into '+vsTableName+' (rp_time,rp_sw) '+
    'values :NowDateTime,:vdCurrent');
    Parameters.ParamByName('NowDateTime').asdatetime=now;//要格式可以用这两个formatdatetime(),strtodatetime
    Parameters.ParamByName('vdCurrent').Value=1;
    execsql;
    end;
      

  3.   

    是你的connectionstring不对吧,否则用楼上的方法已经搞定了