关于LinQ的难题 string whereStr="";
foreach (MyType part in parts)
{
if (whereStr != null)
whereStr += " || ";
whereStr += " contact.Field<string>(\"CustoemrID\") == " + part.CustomerID + " && contact.Field<string>(\"otherID\")==" + part.otherID;
} IEnumerable<DataRow> query =
from contact in contactTable.AsEnumerable()
where // 怎么把这个Wherestr字符串拼接到这个地方? 或者有什么其他的做法不用拼接字符串?
zi
foreach (MyType part in parts)
{
if (whereStr != null)
whereStr += " || ";
whereStr += " contact.Field<string>(\"CustoemrID\") == " + part.CustomerID + " && contact.Field<string>(\"otherID\")==" + part.otherID;
} IEnumerable<DataRow> query =
from contact in contactTable.AsEnumerable()
where // 怎么把这个Wherestr字符串拼接到这个地方? 或者有什么其他的做法不用拼接字符串?
zi
解决方案 »
- webBrowser1控件 连续请求返回同样的信息
- 如何在一个网页中弹出一个层并且用另外一个层遮盖整个网页
- 关于C#中的try{} catch{}
- 如果将ArrayList中存储的byte[]数据转化成为byte数据
- 自学一年多,快毕业了,好烦恼!帮帮我!!
- 命名空间的父、子、孙之间是否有什么编程、开发等逻辑关系,还是仅仅为了便于分块管理?
- C#怎么取得音乐文件的音波?
- 是vs.net的bug,还是我程序有错?
- 请问一下,读取保存的项目后为什么不是窗体,而是代码?
- System.Collections下找不到ArrayList
- 把VB函数转换为C#中的问题
- Encoding.GetEncoding(65005)出错
什么意思啊?
怎么拼呢?这个LInQ是操作DataTable的
from contact in contactTable.AsEnumerable()
where // 怎么把这个Wherestr字符串拼接到这个地方? 或者有什么其他的做法不用拼接字符串? 这里的Wherestr 是一个字符串变量。
保存着LinQ的Where条件
怎么写到LinQ中去?
//查询
var xxxxxx = from w in data.News
where str()
select w;
//return bool
public static bool str()
{
return true;
}
public static bool str()
{
return true;
}
这个Str必须得能传参数吧。
比如:
public static bool str(string id)
{
foreach ( string _id in myids)
if _id ==id return true
return false;
}var xxxxxx = from w in data.News
where str(w.id)
select w;是这样么?
这样的查询怎样做,每一项都不固定,随机选,如果也用拼接的话,应该怎样写
在wcf+linq实现,大家给帮忙给看看