Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 不存在从对象类型System.Int32[]到已知托管提供程序本机类型的映射_C#_Asp.net_Ado.net - Fatal编程技术网

C# 不存在从对象类型System.Int32[]到已知托管提供程序本机类型的映射

C# 不存在从对象类型System.Int32[]到已知托管提供程序本机类型的映射,c#,asp.net,ado.net,C#,Asp.net,Ado.net,我在下面的代码中遇到上述错误。这里listid是一个整数列表 您可以将查询更改为: SqlCommand cmd = new SqlCommand (String.Format ("SELECT * FROM status WHERE uid IN ({0})", String.Join (",", listid))); 并删除AddWithValue行。您可以将查询更改为: SqlCommand cmd = new SqlCommand (String.Format ("SELECT * F

我在下面的代码中遇到上述错误。这里listid是一个整数列表


您可以将查询更改为:

SqlCommand cmd = new SqlCommand (String.Format ("SELECT * FROM status WHERE uid IN ({0})", String.Join (",", listid)));

并删除AddWithValue行。

您可以将查询更改为:

SqlCommand cmd = new SqlCommand (String.Format ("SELECT * FROM status WHERE uid IN ({0})", String.Join (",", listid)));

并删除AddWithValue行。

非常感谢您的帮助,先生。。它在你的回答中起作用了我已经尝试向SQL字符串添加一个int列表大约一个小时了,这是唯一看起来可行的方法,这让我感到惊讶。微软支持C语言中某些方法的正确性,但也经常会有一些异常,我不认为这会阻止sql注入。您正在直接插入值。非常感谢您的帮助,先生。。它在你的回答中起作用了我已经尝试向SQL字符串添加一个int列表大约一个小时了,这是唯一看起来可行的方法,这让我感到惊讶。微软支持C语言中某些方法的正确性,但也经常会有一些异常,我不认为这会阻止sql注入。您将直接插入这些值。不能将数组作为SQL参数传递。你有没有看到它在其他方面起作用?不能将数组作为SQL参数传递。你有没有看到它在其他方面起作用?