Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SqlDataSource control ... joining on multiple databases 1

Status
Not open for further replies.

VBRookie

Programmer
May 29, 2001
331
US
Hi I'm using .NET 2.0 and am trying to utilize the sqldatasource control in my code. It works fine except for one particular query where I have to do a join on two tables on two different databases.

The problem is that the sqldatasource control seems to only process one connection string and I'd need to supply two (1 for each database). Is there a way around this or can I not use the sqldatasource control in this instance?

Here is the code:
Code:
SqlDataSource2.SelectParameters.Clear()
  SqlDataSource2.SelectCommand = "usp_PriorAuth"
  SqlDataSource2.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
  SqlDataSource2.SelectParameters.Add("ActionCode", "SEL")
  SqlDataSource2.SelectParameters.Add("SelectCode", "1")
  SqlDataSource2.SelectParameters.Add("BatchNbr", drpBatch.SelectedItem.Value)
  SqlDataSource2.ConnectionString = DB.GetConn("TestConnect")
  SqlDataSource2.ConnectionString = DB.GetConn("TestKMA")

Many Thanks,
- VB Rookie
 
You can only have one connection string per sqldatasource. If you are querying against another DB, then you have to set up a linked server so that you can do that.

Jim
 
Ok thanks Jim for the information ... that's pretty much what I needed to know. I hadn't found a clear answer on google for this.

Again Many Thanks,
- VB Rookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top