容易解决的
数据库表中的各字段对应着序号:
所以你只要知道你数据库的字段数就可以查询
以下是在应用程序中实现:
private sub query_db()
set rs=db.execute(Table)
i=0
do while i<colum
sql="select * from Table where rs(0) like '%"&key&"%'"
set rs0=db.execute(sql)
i=i+1
loop
end sub
'其中db为你所打开的记录源,
'table是你所要查询的表名,
'key是你要查的关键字.
'colum是table表的字段数
数据库表中的各字段对应着序号:
所以你只要知道你数据库的字段数就可以查询
以下是在应用程序中实现:
private sub query_db()
set rs=db.execute(Table)
i=0
do while i<colum
sql="select * from Table where rs(0) like '%"&key&"%'"
set rs0=db.execute(sql)
i=i+1
loop
end sub
'其中db为你所打开的记录源,
'table是你所要查询的表名,
'key是你要查的关键字.
'colum是table表的字段数
where (xtype=175 or xtype=167) and (id in (select id from sysobjects where name=@table))
---- char-->175,varchar-->167
open curCol fetch next from curCol into @col while @@FETCH_STATUS=0 begin execute('insert into #TableList select '''+@table+''','''+@col+''' from '+@table+' where '+@col+'='''+@sname+'''') fetch next from curCol into @col end close curCol deallocate curCol fetch next from curTab into @tableendclose curTabdeallocate curTabset nocount offselect distinct * from #TableListdrop table #tablelist end
--exec searchname '20020100002'
--->(在當前數据庫中所有表中尋找特定信息)
--參考一位前輩的貼子