参数标记 [英] Parameter Marker

查看:85
本文介绍了参数标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Decoupled Change Tracking aproach(http://www.syncguru.com/projects/SyncServicesDemoDecoupledTracking.aspx

一切都已设置但我收到错误我还没有找到解决方案。

通过检查跟踪器日志我发现如果我使用"?"参数标记在 SelectIncrementalInsertsCommand的参数中,这些参数作为NULL传递给存储过程。另一方面,如果我使用"@"参数标记我得到一个例外 - "在集合中找不到参数?id" - 虽然在跟踪器日志中它们被正确捕获和填充。

cmd.Parameters.Add( "?id" MySqlDbType .VarChar).Direction = ParameterDirection .Input;
vs
cmd。 Parameters.Add( " @ id" MySqlDbType .VarChar).Direction = ParameterDirection .Input;

看起来MySQL期待"?"但是如果Sync Framework以"@"开头,则Sync Framework只能填充参数值。

有没有人有解决方案?



Wilson Oliveira

Hi,

I'm trying to do a bidirectional synchronization between a client (SQLServerCE) and a server (MySQL) using the Decoupled Change Tracking aproach (http://www.syncguru.com/projects/SyncServicesDemoDecoupledTracking.aspx).

Everything is set up but I'm getting an error for which I haven't found a solution for yet.

By checking the tracer log I figured out that if I use the "?" Parameter Marker in the SelectIncrementalInsertsCommand's parameters these are passed to the stored procedure as NULL. On the other side if I use the "@" Parameter Marker I get an exception - "Parameter ?id not found in the collection" - although in the tracer log they're caught and populated correctly.

cmd.Parameters.Add("?id", MySqlDbType.VarChar).Direction = ParameterDirection.Input;
vs
cmd.Parameters.Add("@id", MySqlDbType.VarChar).Direction = ParameterDirection.Input;

It looks like a MySQL is expecting "?" but the Sync Framework only is able to fill the parameter values if they start with "@".

Does anyone have a solution for this?

---
Wilson Oliveira

推荐答案

我已经更新到使用"@"的mysql-connector-net-5.2.5作为参数标记,此问题现已修复。



Wilson Oliveira
I've updated to mysql-connector-net-5.2.5 which uses "@" as a Parameter Marker and this problem is now fixed.

---
Wilson Oliveira


这篇关于参数标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆