Ho un datatable creato in C#.Passa datatable ad una stored procedure
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
}
E ho una stored procedure
CREATE PROCEDURE [dbo].[Admin_Fill]
-- Add the parameters for the stored procedure here
@MetricId INT,
@Descr VARCHAR(100),
@EntryDE VARCHAR(20)
Quello che voglio è quello di passare il datatable a questa stored procedure, come?
devo creare un tipo di tavolo e definire la struct ure in SQL Server? –
Sì, è necessario creare un nuovo tipo di tabella – AdaTheDev