时间:2021-07-01 10:21:17 帮助过:3人阅读
Command需要赋予Text,也许还会有参数
cmd.CommandText = "exec dbo.my_stored_proc";
//或
cmd.CommandText = "SELECT * FROM Table";
var metadata = new[] { new SqlMetaData("value", SqlDbType.NVarChar, 10) }; // the members of your SQL Server table type var data1 = new SqlDataRecord(metadata); // In reality you‘d create a helper method for this data1.SetValues("1"); var data2 = new SqlDataRecord(metadata); data2.SetValues("2"); var data = new [] { data1, data2 }; cmd.Parameters.Add(new SqlParameter("@stringArrayInput", data) { SqlDbType = SqlDbType.Structured });
LightSpeed 之Sql和存储过程的使用
标签: