What I am trying to do: I have created a T-SQL stored procedure that returns a single column from multiple tables.

```
CREATE PROCEDURE [dbo].[Search_] 
    (@am VARCHAR(12)) 
AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @DBName VARCHAR(128)

    DECLARE Tbl CURSOR READ_ONLY FOR
         SELECT LEFT(TABLE_NAME, 27) AS Tbl 
         FROM ap.INFORMATION_SCHEMA.TABLES 
         WHERE TABLE_NAME LIKE LEFT('STORED_PRODUCTS_FR_[0-9]_%', 27)
           AND SUBSTRING(TABLE_NAME, 20, 2) LIKE '%[0-9]%'
           AND SUBSTRING(TABLE_NAME, 23, 1) = '_'
         ORDER BY
             CONVERT(INT, SUBSTRING(TABLE_NAME, 24, 4)) ASC,
             CONVERT(INT, SUBSTRING(TABLE_NAME, 21, 2)) ASC

    OPEN Tbl

    FETCH NEXT FROM Tbl INTO @DBName

    WHILE @@FETCH_STATUS = 0
    BEGIN
        DECLARE @SQL VARCHAR(100)
        SET @sql = 'SELECT [column 3] FROM ' + @DBName + ' WHERE [COLUMN 4] = ' + @am + '';

        EXEC(@sql)

        FETCH NEXT FROM Tbl INTO @DBName
    END
END

CLOSE Tbl
DEALLOCATE Tbl

```

Then in asp.net, I want to populate a gridview...

```
try
{
    SqlDataAdapter dt = new SqlDataAdapter();

    string message = string.Empty;
    con.Open();

    cmd.CommandText = "Search_";
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@am", am.Text);   
    cmd.Connection = con;

    dt.SelectCommand = cmd;
    DataTable dTable = new DataTable();
    dt.Fill(dTable);

    GridView1.DataSource = dTable;
    GridView1.DataBind();
}
catch (Exception ex)
{
    throw ex;
}

```

That only returns a single row (the first one) of the stored procedure.

What am I doing wrong? It seems that the values are overwriting themselves.

Any help from anyone....