简体   繁体   English

从多个数据库中搜索记录

[英]searching records from multiple databases

I have more than 10 databases with same tables but different records.我有超过 10 个具有相同表但不同记录的数据库。

Now I would like to have a search engine that can search all the databases.现在我想要一个可以搜索所有数据库的搜索引擎。 Let say for example I am going to search for a person by last name or first name, then the search must go to all of the databases, the query will search all the databases.比方说我要按姓氏或名字搜索一个人,那么搜索必须 go 到所有数据库,查询将搜索所有数据库。

How can i do that?..我怎样才能做到这一点?..

Do you have sample code for ASP.NET C#?你有 ASP.NET C# 的示例代码吗? thanks!谢谢!

Hi @Dhenn create a view in your one database by union on the 10 tables and you can get easy search on that嗨@Dhenn 通过联合 10 个表在你的一个数据库中创建一个视图,你可以很容易地搜索它

table1 is in database1 and table2 is in database2 then table1 在 database1 中,table2 在 database2 中

 select * from  database1.dbo.table1. 
union all

 select * from  database2.dbo.table1. 

.
.
.

other option you can fire 10 hits to 10 databases from asp.net c# and then merge result and show on screen.其他选项您可以从 asp.net c# 向 10 个数据库触发 10 次点击,然后合并结果并显示在屏幕上。

Please Ref this请参考这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM