select 1 from dbo.sysobjects where exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[要判断的表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
您的意思是if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[要判断的表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) 条件为真处理过程,这里我直接写text2.text="something"???可是这样写会出错啊?为什么呢? else 条件为假的处理过程 end
這個是SQL語句!樓上。Query->Close(); Query->SQL->Clear(); Query->SQL->Add("select * from dbo.sysobjects where id = object_id(N'[dbo].[要判断的表]') and OBJECTPROPERTY(id, N'IsUserTable'"); Query->Open(); if(Query->Eof) text2.text="表不存在"; else text2.text="表存在哦";---------------- 這個是一般的程序處理過程
你所说得query->close是VC里得写法?VB里怎么判断Query->EOF那条语句?
dim rs as adodb.rescordset set rs=new ADODB.ResordSet ... if not rs.Eof then ... else ... end if
dim rs as adodb.rescordset set rs=new ADODB.ResordSet ... if not rs.Eof then //为什么这句提示“对象关闭时无法操作”?我即使rs.open....也是同样得错误,为什么呢?谢谢 ... else ... end if
条件为真处理过程,这里我直接写text2.text="something"???可是这样写会出错啊?为什么呢?
else
条件为假的处理过程
end
Query->SQL->Clear();
Query->SQL->Add("select * from dbo.sysobjects where id = object_id(N'[dbo].[要判断的表]') and OBJECTPROPERTY(id, N'IsUserTable'");
Query->Open();
if(Query->Eof)
text2.text="表不存在";
else
text2.text="表存在哦";----------------
這個是一般的程序處理過程
set rs=new ADODB.ResordSet
...
if not rs.Eof then
...
else
...
end if
set rs=new ADODB.ResordSet
...
if not rs.Eof then //为什么这句提示“对象关闭时无法操作”?我即使rs.open....也是同样得错误,为什么呢?谢谢
...
else
...
end if