I have a data table created in C#.
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Age", typeof(int));
dt.Rows.Add("James", 23);
dt.Rows.Add("Smith", 40);
dt.Rows.Add("Paul", 20);
I want to pass this to the following stored procedure.
CREATE PROCEDURE SomeName(@data DATATABLE)
AS
BEGIN
INSERT INTO SOMETABLE(Column2,Column3)
VALUES(......);
END
My question is : How do we insert those 3 tuples to the SQL table ? do we need to access the column values with the dot operator ? or is there any other way of doing this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…