Click here to Skip to main content
15,911,531 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Knowing the pixel size of each character Pin
Rajiya17-Jan-07 21:12
Rajiya17-Jan-07 21:12 
GeneralRe: Knowing the pixel size of each character Pin
shreekar17-Jan-07 22:56
shreekar17-Jan-07 22:56 
GeneralRe: Knowing the pixel size of each character Pin
Rajiya17-Jan-07 23:55
Rajiya17-Jan-07 23:55 
QuestionCombobox items Clear problem Pin
Bso_Cool17-Jan-07 14:39
Bso_Cool17-Jan-07 14:39 
AnswerRe: Combobox items Clear problem [modified] Pin
MatrixCoder17-Jan-07 15:16
MatrixCoder17-Jan-07 15:16 
AnswerRe: Combobox items Clear problem Pin
The ANZAC17-Jan-07 21:59
The ANZAC17-Jan-07 21:59 
QuestionSelecting a specific cell in a datagrid Pin
BMackKC17-Jan-07 10:53
BMackKC17-Jan-07 10:53 
Questionexample query for join two tables in two different database Pin
tanya foster17-Jan-07 10:31
tanya foster17-Jan-07 10:31 
I am sorry if this is a redundant question. I have searched messages in the SQL and Visual Basic .net message boards and have not seen complete code example for setting up connections before executing a query which joins two(or more) tables and each table exists in a different database but on the same server.

I am aware of the naming convention ServerName.DatabaseName.TableName.Column

I am aware of populating datasets in vb.net as exemplified below


-------------- Begin populate dataset example -----------------------

Dim DataSetForReport As New DataSet
Dim BlueConnection As String
Dim BlueSQLConn As SqlConnection
Dim BlueQuery As String
Dim i, TotalRowsReturned As Integer

BlueConnection= "uid=test;password=snow;dtabase=DataBaseBlue; server=Spock"

BlueSQLConn = New SqlConnection(BlueConnection)

BlueSQLConn .Open()

BlueQuery = "Select Table1.ColumnA, Table2.ColumnB from Table1, Table2 where ColumnA=ColumnB"

Dim SqlDataAdapterForPopulateDataTable As New SqlDataAdapter(BlueQuery, BlueConnection)

i = SqlDataAdapterForPopulateDataTable.Fill(DataSetForReport, "TableOfData")
SqlDataAdapterForPopulateDataTable.Dispose()
SQLConn.Close()

If i > 0 Then
'query returned at least one row
TotalRowsReturned = i
End If

-------------- End populate dataset example -----------------------

Goal: to be able to change BlueQuery variable to refer to two different databases - DataBaseBlue and DataBaseRed like something below...

BlueQuery = "Select DatabaseBlue.Table1.ColumnA, DatabaseRed.Table2.ColumnB from DatabaseBlue.Table1, DatabaseRed.Table2
where DatabaseBlue.Table1.ColumnA=DatabaseRed.Table2.ColumnB"


If I create another connection like

RedConnection = "uid=Red; password=Car; dtabase=DataBaseRed; server=Spock"

and use it in an addition SQLConnection declaration

Dim RedSQLConn As SqlConnection
RedSQLConn = New SqlConnection(RedConnection)
RedSQLConn.Open()

How do I enable/pass SqlDataAdapterForPopulateDataTable variable two different connections? Or how do I accomplish the "Goal" in another way?

Thanks for any suggestions.
tanya



AnswerRe: example query for join two tables in two different database Pin
Dave Kreskowiak18-Jan-07 4:23
mveDave Kreskowiak18-Jan-07 4:23 
GeneralRe: example query for join two tables in two different database Pin
tanya foster18-Jan-07 5:06
tanya foster18-Jan-07 5:06 
GeneralRe: example query for join two tables in two different database Pin
Dave Kreskowiak18-Jan-07 8:26
mveDave Kreskowiak18-Jan-07 8:26 
QuestionReading the value of excel checkbox with vb.net Pin
Ole.N17-Jan-07 10:16
Ole.N17-Jan-07 10:16 
AnswerRe: Reading the value of excel checkbox with vb.net Pin
the.bombardier17-Jan-07 23:10
the.bombardier17-Jan-07 23:10 
QuestionTable Layout Pin
thesemplice17-Jan-07 10:13
thesemplice17-Jan-07 10:13 
AnswerRe: Table Layout Pin
Christian Graus17-Jan-07 10:17
protectorChristian Graus17-Jan-07 10:17 
GeneralRe: Table Layout Pin
thesemplice17-Jan-07 10:22
thesemplice17-Jan-07 10:22 
GeneralRe: Table Layout Pin
Christian Graus17-Jan-07 10:48
protectorChristian Graus17-Jan-07 10:48 
GeneralRe: Table Layout Pin
thesemplice17-Jan-07 10:57
thesemplice17-Jan-07 10:57 
QuestionNEW TO VB 6.0 Pin
ranabanerjee17-Jan-07 10:00
ranabanerjee17-Jan-07 10:00 
AnswerRe: NEW TO VB 6.0 Pin
Dave Kreskowiak17-Jan-07 10:09
mveDave Kreskowiak17-Jan-07 10:09 
GeneralRe: NEW TO VB 6.0 Pin
ranabanerjee17-Jan-07 10:12
ranabanerjee17-Jan-07 10:12 
GeneralRe: NEW TO VB 6.0 Pin
Christian Graus17-Jan-07 10:15
protectorChristian Graus17-Jan-07 10:15 
AnswerRe: NEW TO VB 6.0 Pin
Christian Graus17-Jan-07 10:12
protectorChristian Graus17-Jan-07 10:12 
GeneralRe: NEW TO VB 6.0 Pin
ranabanerjee17-Jan-07 10:15
ranabanerjee17-Jan-07 10:15 
GeneralRe: NEW TO VB 6.0 Pin
Christian Graus17-Jan-07 10:16
protectorChristian Graus17-Jan-07 10:16 

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.