使用create table 后立即执行insert into,结果不识别新建立的表?
来源:百度知道 编辑:UC知道 时间:2024/06/21 17:19:16
strsql := 'create Table "bbb" ("b1" Integer)';
with dm.ClientDataSet_Public do
begin
if Active then Active:=True;
CommandText := strsql;
Execute;
end;
strsql := 'insert into "bbb" values(10)';
with dm.ClientDataSet_Temp do
begin
if Active then Active:=True;
CommandText := strsql;
Execute;
end;
我是在三层模式下编程的,需要在程序中动态建表。如果在程序中先动态建表,退出程序,然后再运行程序中的(insert into ...)则正确,如果建表后,马上再insert into。。。则就不识别新建的表,不知为什么?我使用Delphi与InterBase7.1数据库。
谢谢各位仔细一些,是 如果建表create table 后,马上再insert into。。。则就不识别新建的表
with dm.ClientDataSet_Public do
begin
if Active then Active:=True;
CommandText := strsql;
Execute;
end;
strsql := 'insert into "bbb" values(10)';
with dm.ClientDataSet_Temp do
begin
if Active then Active:=True;
CommandText := strsql;
Execute;
end;
我是在三层模式下编程的,需要在程序中动态建表。如果在程序中先动态建表,退出程序,然后再运行程序中的(insert into ...)则正确,如果建表后,马上再insert into。。。则就不识别新建的表,不知为什么?我使用Delphi与InterBase7.1数据库。
谢谢各位仔细一些,是 如果建表create table 后,马上再insert into。。。则就不识别新建的表
首先
strsql:= 'create Table bbb(b1 Int)';这样写就行了
然后在建表时通常考虑该表是否存在,即:
strsql:= 'if exists(select name from sysobjects where name='bbb' and type='u') begin drop table bbb end ';
strsql:=strsql+' create Table bbb(b1 Int) '
我用adoquery重来没碰过这种情况,我是在两层结构下开发的,用execsql,都可以
呵呵
为什么不先把表建好 这样我觉得麻烦了!
如果是SQL是不是要先导入数据库啊
create table
create table tab_new like tab_old (使用旧表创建新表)?
使用create table 后立即执行insert into,结果不识别新建立的表?
请问Oracle 中create any table 和create table权限的区别是什么?
ASP " CREATE TABLE NE1 (name1 TEXT(32))")
怎样在visual foxpro用create table 建表
用sql语法create table在线生成表时自动编号的数据类型怎么弄?
怎样判断java的statement执行create table 等ddl时是否成功
谁能给个SQL中用CREATE TABLE 创建数据库表的事例
关于Create函数的使用问题