I am working on a SQL server monitoring project. In this, I want to get data from all instances of SQL Server installed on the machine. To do this, I wrote a CLR stored procedure in which data entered two different SqlDataReader objects, and I want to combine these two datareder objects.
Is it possible to combine two SQLdatareader objects?
Below is the situation when I ran into this problem:
SqlConnection conn = new SqlConnection("ConnectionSting of 1st SQLServerInstance") string query = "select dbid,uid,cpu from [master].[sys].sysprocesses"; SqlCommand SelectCmmand = new SqlCommand(query, conn); SqlDataReader rd1; conn.Open(); rd1 = SelectCmmand.ExecuteReader(); conn.Close(); conn = new SqlConnection("ConnectionSting of 2nd SQLServerInstance") SqlCommand SelectCmmand = new SqlCommand(query, conn); SqlDataReader rd2; conn.Open(); rd2 = SelectCmmand.ExecuteReader(); conn.Close(); SqlPipe sp; sp = SqlContext.Pipe; sp.Send(?????);
Now the sp.Send (??) method wants the SQLDataReader object to be the parameter where I want to send the above data from two different connection strings.
So how do I combine / combine rd1 and rd2?
source share