select * from tb where c_status in ('"+status+"')
status 是定义的数组,数组中我已经赋值了
这样查不出结果。。
应该怎么写呢?(我想查找 c_status符合status中值的记录,c_status是string类型的)
status 是定义的数组,数组中我已经赋值了
这样查不出结果。。
应该怎么写呢?(我想查找 c_status符合status中值的记录,c_status是string类型的)
for(int i = 0;i < status.Length;i++)
str += "'" + status[i] + "',";str = str.Trim(',');"select * from tb where c_status in ("+status+")"
这样试试
=====================
status 变量 的值按照这种格式进行付值: 'aaa','bbb','ccc'string sql="select * from tb where c_status in ("+status+")";
int i=0;
foreach(string s in status)
{
i++;
strRes+=s;
if(i<status.length-1)
{
strRes+=",";
}
}
select * from tb where c_status in ('"+strRes+"')