在sqlserver上,新增table/type/SP
--add tablecreate table 客户主档(ID varchar(30) NULL)--add typeCREATE TYPE dbo.typ_客户主档 AS TABLE( ID varchar(30) NULL) --add spcreate PROCEDURE [dbo].[SP_Insert_客户主档] @myTableType typ_客户主档 readonlyASBEGIN insert into [dbo].客户主档 ([ID] )select * from @myTableType select @@ROWCOUNTEND
C#就可以直接传入datatable给sqlserver了
var command = new SqlCommand("SP_Insert_客户主档") command.CommandType = CommandType.StoredProcedure})var dt = new DataTable(); //create your own data tablecommand.Parameters.Add(new SqlParameter("@myTableType", dt));command.ExecuteScalar();