传递给系统调用的缓冲区太小,无法保存返回数据ERROR [英] A buffer passed to a system call is too small to hold return data ERROR

查看:173
本文介绍了传递给系统调用的缓冲区太小,无法保存返回数据ERROR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用ASP.Net连接到

I was able to connect to

iSeries Access ODBC Driver



简单的where子句和select正在运行但是当我有遇到WHERE IN CLAUSE它会抛出错误。

我的代码如下:



Dim sql as string =Select * from table中的列(?)



cmd.Parameters.Add(,Odbc.OdbcType.Char).Value = txt_Param.Text



我的文本框的价值为'a','b','c'





我收到此错误:



using ASP.Net.
Simple where clause and select is working but when I have encountered the WHERE IN CLAUSE it throws back error.
My code is like this below:

Dim sql as string ="Select * from table where column in (?)"

cmd.Parameters.Add("", Odbc.OdbcType.Char).Value = txt_Param.Text

and my textbox will have value of 'a','b','c'


I am getting this error:

ERROR [22018] [IBM][iSeries Access ODBC Driver]Column 1: CWB0111 - A buffer passed to a system call is too small to hold return data ERROR [22001] [IBM][iSeries Access ODBC Driver]Column 1: Character data right truncation.





我发现参数是一比一。我怎么会在odbc中有很多参数?



我尝试过:



尝试更改字符串并添加逗号,但它不起作用



I figured out that parameters is one is to one. how will i have many parameters in odbc?

What I have tried:

Tried changing string and adding commas but it is not working

推荐答案

这样的事情:

Something like this:
Dim sql As New StringBuilder("SELECT * FROM table WHERE column IN (")

Dim parts As String() = txt_Param.Text.Split(","c)
For i As Integer = 0 To parts.Length - 1
    cmd.Parameters.Add("", Odbc.OdbcType.Char).Value = parts(i)
    If i <> 0 Then sql.Append(", ")
    sql.Append("?"c)
Next

sql.Append(")"c)
cmd.CommandText = sql.ToString()



你可能想查看 Dapper [ ^ ],这使得这种查询变得更加容易。


You might want to look at Dapper[^], which makes this sort of query much easier.


这篇关于传递给系统调用的缓冲区太小,无法保存返回数据ERROR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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