[英]How do I use a MySQL stored procedure from c# which sends a table as input to the store procedure? I have T-SQL working
在 Transact-SQL 中,我有存储过程的输入参数
@DataTable InputTabel READONLY,
“InputTabel”定义为:
CREATE TYPE InputTabel AS TABLE
(
ID INT NULL,
RESULT_INDEX INT NULL
)
在 C# 方面,我使用此代码来定义参数:
SqlParameter parameter = new SqlParameter( );
parameter.ParameterName = "@DataTable ";
parameter.SqlDbType = System.Data.SqlDbType.Structured;
parameter.TypeName = "InputTabel";
parameter.Value = theInputTable;
其中输入表定义为:
DataTable theInputTable = new DataTable("TheInputTableName");
theInputTable.Columns.Add( "ID", typeof( Int32 ) );
theInputTable.Columns.Add( "RESULT_INDEX", typeof( string ) );
我现在必须将这种方法转移到 MySQL 和wounder 我该怎么做? 在 C# 端和服务器端。
不幸的是,MySql 没有实现表值参数,但确实存在替代方案:
有关这两种方法的更多信息: 在 MySQL 中创建表变量
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.