foreach statement cannot operate on variables of type 'int' because 'int' does not contain a public definition for 'GetEnumerator'
My Code
private void button3_Click(object sender, EventArgs e)
{
var query_05 = kn_01.Sp_prueba_00(txt_server.Text, txt_database.Text, txt_table.Text);
foreach (var item_21 in query_05)
{
dt_apellidos.Rows.Add(item_21);
}
}
//Strore Procedure
Create procedure Sp_prueba_00
(
@Servidor_source varchar(50),
@Database_Source varchar(50),
@Table_Source varchar(50)
)
as
Declare @sql varchar(max)
set @sql = 'select * ' + ' from [' + (@Servidor_source) + '].[' + (@Database_Source) + '].dbo.' + (@Table_Source)
execute (@sql)
return 0