Click here to Skip to main content
15,311,076 members
Home / Discussions / C#
   

C#

 
GeneralRe: making c# programs run everywhere Pin
Heath Stewart29-Dec-03 5:22
protectorHeath Stewart29-Dec-03 5:22 
GeneralLaunching Other Applications Pin
Melanius28-Dec-03 22:37
MemberMelanius28-Dec-03 22:37 
GeneralRe: Launching Other Applications Pin
Jon Newman29-Dec-03 2:30
MemberJon Newman29-Dec-03 2:30 
GeneralRe: Launching Other Applications Pin
Melanius29-Dec-03 4:53
MemberMelanius29-Dec-03 4:53 
GeneralPopulating Combo Box on Key Press Event Pin
Member 33502228-Dec-03 22:23
MemberMember 33502228-Dec-03 22:23 
GeneralRe: Populating Combo Box on Key Press Event Pin
Heath Stewart29-Dec-03 5:18
protectorHeath Stewart29-Dec-03 5:18 
GeneralUsing a database link in a C# program Pin
extremeg28-Dec-03 21:49
Memberextremeg28-Dec-03 21:49 
GeneralRe: Using a database link in a C# program Pin
Heath Stewart29-Dec-03 5:12
protectorHeath Stewart29-Dec-03 5:12 
There's no such thing as a database link object. There is connection classes like SqlConnection, but unless you plan on joining these results yourself, you can only use one in certain objects like a SqlDataAdapter. There is ways to link databases together in some RDBMS's like SQL Server. You can then use a stored proc or a view to query both databases using a syntax like "database.owner.object". In most cases, leaving this on the server provides faster access and centralized management of the query and the database links. You could then write a view like so:
SELECT A.Name, A.Birthday, B.AccountID
FROM Table1 A JOIN db2.dbo.Table2 B ON A.ID = B.ID
where db2 is a linked database.

You can find more information about this in the documentation for your RDBMS like SQL Server. I also suggest you move this to the SQL forum if you continue this way.

Otherwise, you'll need two SqlConnection objects and two pairs of SqlCommand and SqlDataReader objects (note, I'm assuming SQL here because many lower-end RDBMS's don't support database linking that would use System.Data.OleDb classes). Then you'll have to read the results and programmatically join these together. This will most likely be much slower and more risky that allowing the database server to do so.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: Using a database link in a C# program Pin
extremeg30-Dec-03 21:20
Memberextremeg30-Dec-03 21:20 
GeneralRe: Using a database link in a C# program Pin
Heath Stewart31-Dec-03 3:40
protectorHeath Stewart31-Dec-03 3:40 
GeneralRe: Using a database link in a C# program Pin
extremeg6-Jan-04 20:59
Memberextremeg6-Jan-04 20:59 
GeneralRe: Using a database link in a C# program Pin
Heath Stewart6-Jan-04 21:11
protectorHeath Stewart6-Jan-04 21:11 
Questiondeveloping applications - MDI and SDI ? Pin
jeffreylreed28-Dec-03 21:27
Memberjeffreylreed28-Dec-03 21:27 
AnswerRe: developing applications - MDI and SDI ? Pin
Heath Stewart29-Dec-03 5:03
protectorHeath Stewart29-Dec-03 5:03 
GeneralRe: developing applications - MDI and SDI ? Pin
jeffreylreed29-Dec-03 8:45
Memberjeffreylreed29-Dec-03 8:45 
GeneralRe: developing applications - MDI and SDI ? Pin
Heath Stewart29-Dec-03 9:32
protectorHeath Stewart29-Dec-03 9:32 
GeneralPrintDocument PrintPage event Pin
Yaron K.28-Dec-03 20:36
MemberYaron K.28-Dec-03 20:36 
GeneralRe: PrintDocument PrintPage event Pin
Heath Stewart29-Dec-03 4:58
protectorHeath Stewart29-Dec-03 4:58 
GeneralRe: PrintDocument PrintPage event - a real answer Pin
Bryan White29-Dec-03 14:58
MemberBryan White29-Dec-03 14:58 
GeneralRe: PrintDocument PrintPage event - a real answer Pin
Yaron K.29-Dec-03 19:57
MemberYaron K.29-Dec-03 19:57 
GeneralRe: PrintDocument PrintPage event - a real answer Pin
Heath Stewart30-Dec-03 3:24
protectorHeath Stewart30-Dec-03 3:24 
GeneralRe: PrintDocument PrintPage event - a real answer Pin
Bryan White4-Jan-04 9:47
MemberBryan White4-Jan-04 9:47 
GeneralRe: PrintDocument PrintPage event - a real answer Pin
Heath Stewart4-Jan-04 9:54
protectorHeath Stewart4-Jan-04 9:54 
GeneralUsing IActiveDesktop in C# Pin
Okeno Palmer28-Dec-03 19:01
MemberOkeno Palmer28-Dec-03 19:01 
GeneralRe: Using IActiveDesktop in C# Pin
Heath Stewart29-Dec-03 4:48
protectorHeath Stewart29-Dec-03 4:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.