0

I've got a Microsoft SQL Database and a MySQL Database that I need to join and put into a GridView.

So far I've been successful using ASP and a SqlDataSource like so

<asp:SqlDataSource 
      ID="mySqlDataSource" runat="server" ConnectionString="<%$ connectionStrings:cs1 %>" 
      ProviderName="MySql.Data.MySqlClient" SelectCommand="SELECT DashName, DashIP1, 
      SNMP_Name, DoesBackup, DashDevType FROM ConfigBackupDevices">
</asp:SqlDataSource>

How ever I'm not sure how to join in the second database. Do I need to do this in the code behind or is it possible in asp?

1
  • No you cant use 2 different DB at same time.. Commented Jan 26, 2015 at 16:22

2 Answers 2

1

It is not possible to bind two data sources to one control, but you can use multiple tables in one data source. You can also join tables.

Sign up to request clarification or add additional context in comments.

2 Comments

So should I abandon the SqlDataSource and just make a datatable in code behind with the two databases then bind the datatable to the gridview?
you can try this link as some people have posted some answers there to see if it helps: c-sharpcorner.com/Forums/Thread/81295/…
1

It is not possible to bind two databases with one sql datasource.

The best option is create either DataTable or DataSet with desired data using Join to these different databases. then bind the grid using that DataTable or DataSet.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.