我正在使用节点并在MariaDB中调用存储过程。存储过程有3个输出参数。如果我打电话在HeidiSQL中执行以下查询,它的工作没有问题:
int RecordToAdd = _product_Id.Count;
for (int i = 0; i < RecordToAdd; i++)
{
Cmd.Parameters["@customer_id"].Value = _customer_Id;
Cmd.Parameters["@Employee_id"].Value = _employee_Id;
Cmd.Parameters["@Product_id"].Value = _product_Id;
Cmd.Parameters["@[Date]"].Value = _date;
Cmd.Parameters["@[Amount_sold]"].Value = _amountSold;
Cmd.Parameters["@[Unit_Price]"].Value = _unitPrice;
Cmd.Parameters["@Total_Price"].Value = _totalPrice;
Cmd.ExecuteNonQuery();
}
但是如果我在node / javascript中执行完全相同的查询,我会收到错误:
int RecordToAdd = _product_Id.Count;
for (int i = 0; i < RecordToAdd; i++)
{
Cmd.Parameters["@customer_id"].Value = _customer_Id;
Cmd.Parameters["@Employee_id"].Value = _employee_Id;
Cmd.Parameters["@Product_id"].Value = _product_Id[i];
Cmd.Parameters["@[Date]"].Value = _date;
Cmd.Parameters["@[Amount_sold]"].Value = _amountSold[i];
Cmd.Parameters["@[Unit_Price]"].Value = _unitPrice[i];
Cmd.Parameters["@Total_Price"].Value = _totalPrice[i];
Cmd.ExecuteNonQuery();
}
在node / Javascript中访问'out'参数的正确方法是什么?
答案 0 :(得分:0)
通过修改node.js中的连接例程并添加参数:
来解决 multipleStatements:true