求助,看这条语句 string.Format("select GoodsName from Goods where ID='{0}'", id) id为方法的参数 问题:当id为一个数组的时候这条语句怎么写?因为id是别的方法返回的
string[] 要是循环这个数组一条一条查的话几十万条记录不卡死~~ 我记着好像可以select GoodsName from Goods where ID in ???
怎么写
是oracle数据库
或者有什么别的方法?讲究效率,因为别的方法返回的是个参数数组string []
string[] 要是循环这个数组一条一条查的话几十万条记录不卡死~~ 我记着好像可以select GoodsName from Goods where ID in ???
怎么写
是oracle数据库
或者有什么别的方法?讲究效率,因为别的方法返回的是个参数数组string []
解决方案 »
- 有关Webbrowser 的COOKIE 设置问题
- Gridview选中某行,和设定某行某列的一个值的链接?
- C#8皇后解法,把注释写清楚一点.
- 求隐藏目录的组件,需在windows和dos下 dir /ah 均查看不到!
- 在C#中如何将sql查询出来的结果放到定义好的数组中
- 再问treeview鼠标右键产生事件在服务器端的解决办法(高手都来看看)
- 开发的程序放到别的电脑上需要安装oracle客户端怎么办
- 如何把上传的文件在程序中删除呢?
- 谁有C#操作powerpoint的例子,不胜感激!
- 新人求帮助 在论坛找了一个下载FTP中文件的代码 不知道该如何具体实现
- WinFrom 绑定listView?
- a=500,b=200,在不考虑第三方变量的情况下交换两个值
试试…
不想实现select * from tablename where id in (你的方法())对吧,你自己试试
Dim id() As String = {"1", "2", "3"} Dim str As String = String.Empty For Each s In id
str = str & s & ","
Next
str = String.Format("select GoodsName from Goods where ID in ({0})", str.Substring(0, str.Length - 1)) MessageBox.Show(str)
string[] ids = 从其他地方得到的一个字符串数组;
string sql = string.Format("selectGoodsName from Goods where ID in ({0})", string.Join(",",ids));
用in的效率很低
能用=尽量别用in还是循环吧for(int i = 0; i< str[].length; i++)
{
string.Format("select GoodsName from Goods where ID in {0}", str[i]) ;
}或者拼成or语句
求求各位看有什么好方法
如果少于一半,就用in
其实都没多大区别的
str = str & s & ","
Next
str = String.Format("select GoodsName from Goods where ID in ({0})", str.Substring(0, str.Length - 1)) MessageBox.Show(str)