在sql中查找表名可以,在delphi中用query查找却是空数据,为什么?

leijinhe 2004-03-30 01:38:33
select name from sysobjects where type = ''U'' and status>0
同一条语句在sql中能得到正确结果,而在delphi的query中却是空数据,请问为什么?
...全文
61 15 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
leijinhe 2004-04-01
  • 打赏
  • 举报
回复
to welllove88(寒林) :
你的语句我很明白,但我不想用ado,目前我用的数据引擎是bde.
to ycdelphicsdn(小新) :
你的语句跟我的有什么区别?
leijinhe 2004-03-31
  • 打赏
  • 举报
回复
ClientData.Close;
ClientData.Params.Values['user name'] := 'sa';
ClientData.Params.Values['password'] := '';
ClientData.LoginPrompt := false;
ClientData.AliasName := 'comimex';
ClientData.DatabaseName := 'imex';
ClientData.Connected := true;

query1.DatabaseName := 'imex';
query1.sql.clear;
query1.sql.add('select name from sysobjects where type = ''U'' and status>0');
query1.open;

上面的有问题吗?
ycdelphicsdn 2004-03-31
  • 打赏
  • 举报
回复
s:='select name from sysobjects where type = ''U'' and status>0';
Query1 do
begin
Close;
SQL.Add(S);
Open;
end;
jyh149129 2004-03-31
  • 打赏
  • 举报
回复
如果直接写在QUERY的SQL属性中则select name from sysobjects where type = 'U' and status>0
如果是在代码中对SQL属性赋值SQL语句则加上引号
welllove88 2004-03-31
  • 打赏
  • 举报
回复
你的语句我不明白!ADOQuery应该没有设置DataBaseName属性的啊

都是设置Connection属性
firefox2000 2004-03-30
  • 打赏
  • 举报
回复
SQLStr:='select name from sysobjects where type =''U''and status>0';
with Query1 do
begin
Close;
SQL.Add(SQLStr);
Open;
end;
  • 打赏
  • 举报
回复
SQLStr:='select name from sysobjects where type ='+''''+'U'+''''+'and status>0';
pandarus 2004-03-30
  • 打赏
  • 举报
回复
delphi和sql的设置连接
web700 2004-03-30
  • 打赏
  • 举报
回复
sql语句的问题
soaringsouth 2004-03-30
  • 打赏
  • 举报
回复
sql语句的问题
设置断点看看,把它再放到查询分析器里看看结果
sxy_9761 2004-03-30
  • 打赏
  • 举报
回复
同意楼上
ph1 2004-03-30
  • 打赏
  • 举报
回复
如果直接写在query的sql里面,不要加两个引号

这样就行了
select name from sysobjects where type = 'U' and status>0
huayuxing 2004-03-30
  • 打赏
  • 举报
回复
把你的数据库连接贴出来看看
prosectinfo 2004-03-30
  • 打赏
  • 举报
回复
可能的原因,你默认的数据库不一样
比如说你在query中用的是master,在query analyzer 中用的是另一个
enzhiyiqiu 2004-03-30
  • 打赏
  • 举报
回复
var
SQLStr:string;

SQLStr:='select name from sysobjects where type = '''+'U'+'''and status>0';

看看

5,928

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧