参数2:参数名称无效。在cyirilic中搜索?

问题描述 投票:0回答:1

我正在开发一个Android应用程序,我有一个listview,顶部有一个EditText和一个搜索按钮,我想根据edittext中的过滤条件显示一些行(公司)。当我搜索一个特定的公司并用英文写下这个名字时,我得到了所需的结果,但是当我尝试用cyrilic(在我的情况下是保加利亚语)搜索公司时,我收到以下错误:

传入的表格数据流(TDS)远程过程调用(RPC)协议流不正确。 参数2:参数名称无效。

我认为错误有点误导,因为我更确定参数名称与SP中的名称相同。这是代码的一小部分:

private void InitCommandCollection()
{
    this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
    this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
    this._commandCollection[0].CommandTimeout = GS.CommandTimeout;
    this._commandCollection[0].Connection = this.Connection;
    this._commandCollection[0].CommandText = "dbo.rsp_ContragentInfo_ByContragentShortName";
    this._commandCollection[0].CommandType = global::System.Data.CommandType.StoredProcedure;
    this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ShortName", global::System.Data.SqlDbType.VarChar, 16, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
c# android sql listview
1个回答
0
投票

我相信你的问题可能是因为varchar,你应该使用nvarchar

nvarchar存储UNICODE数据。如果您有存储UNICODE或多语言数据的要求,则可以选择nvarchar。 Varchar存储ASCII数据,应该是正常使用的数据类型。

© www.soinside.com 2019 - 2024. All rights reserved.