Tengo una tabla de datos creada en C#.Pasar datatable a un procedimiento almacenado
using (DataTable dt = new DataTable())
{
dt.Columns.Add("MetricId", typeof(int));
dt.Columns.Add("Descr", typeof(string));
dt.Columns.Add("EntryDE", typeof(int));
foreach (DataGridViewRow row in dgv.Rows)
{
dt.Rows.Add(row.Cells[1].Value, row.Cells[2].Value, row.Cells[0].Value);
}
// TODO: pass dt
}
Y tengo un procedimiento almacenado
CREATE PROCEDURE [dbo].[Admin_Fill]
-- Add the parameters for the stored procedure here
@MetricId INT,
@Descr VARCHAR(100),
@EntryDE VARCHAR(20)
Lo que quiero es pasar la tabla de datos a este procedimiento almacenado, ¿cómo?
¿tengo que crear un tipo de tabla y definir la estructura ure en SQL Server? –
Sí, necesitamos crear una nueva tabla tipo – AdaTheDev