Home > Net >  Under the different database, please join table how to do?
Under the different database, please join table how to do?

Time:09-18

As the title said, database table TableA part of A field value corresponding to the table in the database B TableB record
I now is to TableA TableB and take into two DataTable, then traverse to find A record in B, such feelings do down efficiency is very low,

In addition there is a kind of thinking is converted to IQueryable, reoccupy lamba expression to make the connection, don't know the performance will improve

CodePudding user response:

Sql Server across Server connection

CodePudding user response:

With the DataTable or IQueryable<> Has nothing to do, mainly is don't have nothing to do in the process of query data record reads to the client to deserialize, or almost all the time on the communication,

CodePudding user response:

1, can be read separately, the corresponding data of different database, the data in the server's memory for finishing operation, (this way should be large amount of data when there will be a problem, and actually the efficiency is not high, but would be a simple)
2, also can be connected to other database SQL statements to query (statement of how to write under the baidu ah, I remember that seems to be some), but I think this way to me, because not used to, no practical experience,

CodePudding user response:

Put one of the data and the other a temporary database table is bad?

CodePudding user response:

If the data volume is not large, so all out, again, no problem, use the DataTable and use the List is fine, of course the List had better, the DataTable is not bad, is eliminated, the

If two table data quantity is big, and ultimately more after the relatively small amount of data, then suggested reader, reading in the process of comparison and analysis,

==========
Latest articles: interpretation of the classic "advanced programming c #" in the fourth chapter of the generic constraint https://mp.weixin.qq.com/s/ZHiaTpzBD-OdPs0Eo7iawQ
Welcome attention WeChat public good "knowing and doing" product technology, make full of structured knowledge base, including the original articles, free classes (c #, Java, Js), technology project, knowledge view, the source code download content, such as

CodePudding user response:

Database A and database B, is on A server?
If it is the same MSSQL two libraries, then directly across the table join,
[name] [dbo]. [table name]

If they are two different servers, so I remember SQL login is across the library statement, after landing can still cross-database queries,
Specific you can check it,

Really not line, then from the two libraries into the filter condition, the data read down, and then join in the code

CodePudding user response:

Quote: refer to fifth floor of the knights templar 18 response:

If the data volume is not large, so all out, again, no problem, use the DataTable and use the List is fine, of course the List had better, the DataTable is not bad, is eliminated, the

If two table data quantity is big, and ultimately more after the relatively small amount of data, then suggested reader, reading in the process of comparison and analysis,

==========
Excuse me, the second scheme specific to do? I used to mention the first, but now table data is more and more big, the speed is slow
  •  Tags:  
  • C#
  • Related