need to get two database values of two storeprocedure value in one gridview to compare there values.right now i have two gridview to get values from two database storeprocedure value
Sub storep() Dim strConnString As String = ConfigurationManager.ConnectionStrings("connTemplate").ConnectionString Dim con As New SqlConnection(strConnString) Dim cmd As New SqlCommand() cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "storeroom" cmd.Connection = con Try con.Open() GridView1.EmptyDataText = "No Records Found" GridView1.DataSource = cmd.ExecuteReader() GridView1.DataBind() Catch ex As Exception Throw ex Finally con.Close() con.Dispose() End Try End Sub Sub storep_Backup() Dim strConnString As String = ConfigurationManager.ConnectionStrings("connBackUp").ConnectionString Dim con As New SqlConnection(strConnString) Dim cmd As New SqlCommand() cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "storeroom" cmd.Connection = con Try con.Open() GridView2.EmptyDataText = "No Records Found" GridView2.DataSource = cmd.ExecuteReader() GridView2.DataBind() Catch ex As Exception Throw ex Finally con.Close() con.Dispose() End Try End Sub
Hi,
Simply you can get data of both the databases like below
SQL
SELECT [CustomerId] ,[Name] ,[Country] FROM [Sample].[dbo].[Customers] UNION ALL SELECT [CustomerId] ,[Name] ,[Country] FROM [Test].[dbo].[Customers]
I hope this will help you out.
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.