DataTable
create table #table1(id bigint,name nvarchar(max)) insert into #table1(id,name)values (1,'xx') insert into #table1(id,name)values (2,'yy') select *fro #table1
SqlConnection conn = new SqlConnection("connection string"); SqlCommand cmd = new SqlCommand("create table #MyTempTable(Stud_Id int, Column1 varchar(50))", conn); conn.Open(); cmd.ExecuteNonQuery(); SqlBulkCopy bulkCopy = new SqlBulkCopy(conn); bulkCopy.DestinationTableName = "#MyTempTable"; bulkCopy.WriteToServer(dt); conn.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)