我正在尝试在Blob sub_type 1字段中搜索某些文本。当搜索文本为1到28个字符时,搜索工作正常。当搜索文本超过28个字符时,我收到“-303算术异常,数字溢出或字符串截断”异常。
当我从数据库运行sql时,它运行正常,只有在使用.NET驱动程序时才会出现问题。
我尝试将parameter.FbDbType更改为FbDbType.Text,但后来我收到了“-303内部错误”。
我的想法已经不多了。有人能帮帮我吗?
提前致谢
ķ
更新:
以下是具有相同结果的示例应用程序:
try
{
FbConnectionStringBuilder csFB = new FbConnectionStringBuilder();
csFB.Database = @"C:\MyDatabase\ITEMS.FDB";
csFB.UserID = "SYSDBA";
csFB.Password = "masterkey";
csFB.Pooling = true;
csFB.ServerType = FbServerType.Embedded;
using (var connection = new FbConnection(csFB.ToString()))
{
connection.Open();
using (var command = connection.CreateCommand())
{
var param = command.CreateParameter();
param.FbDbType = FbDbType.VarChar;
param.Value = "TESTTESTTESTTESTTESTTESTTESTTESTTESTTEST@TEST.COM";
//param.Value = "TEST@TEST.COM";
param.ParameterName = "@parm0";
command.Parameters.Add(param);
command.CommandText = "SELECT * FROM itemprops WHERE UPPER(SUBSTRING(itemdisplaysrcaddr FROM 1)) CONTAINING @parm0";
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine(Convert.ToString(reader["itemdisplaysrcaddr"]));
}
}
}
connection.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.ReadLine();