我有一個linq對象,我想用linq編寫查詢。使用LINQ從linq對象編寫SQL查詢列表
請幫幫我。
輸入:
var tags = (from row in tempChildData.AsEnumerable()
join tagOrder in tupleInfoDataset.Tables["TagHierarchy"].AsEnumerable() on row.Field<Int64>("TAGID") equals tagOrder.Field<Int64>("TAGID")
join tagName in tupleInfoDataset.Tables["SequenceChoiceList"].AsEnumerable() on tagOrder.Field<Int64>("PARENTTAGID") equals tagName.Field<Int64>("TAGID")
join facet in tupleInfoDataset.Tables["FacetType"].AsEnumerable() on tagName.Field<string>("Tag_Name") equals facet.Field<string>("Facetname")
join tagIdInfo in schDataTogetTagid.AsEnumerable() on row.Field<string>("refTagName").Contains(":") ? row.Field<string>("refTagName").Split(':').Last():row.Field<string>("refTagName") equals tagIdInfo.Field<string>("TAGNAME")
where (childList.Contains(row.Field<Int64>("TAGID")) && facet.Field<string>("FacetType").ToLower().Equals("ctype"))
select new
{
Tagid = row.Field<Int64>("TAGID"),
TagIdToInsert=tagIdInfo.Field<Int64>("TAGID"),
MaxOccur = row.Field<string>("Maxoccurs"),
MinOccur =Convert.ToInt32(Convert.ToString(row.Field<string>("Minoccur"))),
ParentTagId=tagOrder.Field<Int64>("PARENTTAGID"),
Order=tagOrder.Field<Int64>("TAG_ORDER"),
ParentTagname = tagName.Field<string>("Tag_Name"),
FacetId=facet.Field<Int64>("FacetID")
}).ToList();
var parentTagID = (from tagIdInfo in tupleInfoDataset.Tables["Tuple"].AsEnumerable()
where tagIdInfo.Field<Int64>("TAGID").Equals(key.Key)
select tagIdInfo.Field<Int64>("ConceptID")).ToList();
long parentID =Convert.ToInt64(parentTagID[0]);
現在我想查詢出上面的代碼爲:
INSERT INTO TUPLE_MAP (TagId,ParentTagId,ParentTagname,MinOccur,MaxOccur,Order)
VALUES (TagIdToInsert,ParentTagId,ParentTagname,MinOccur,MaxOccur,Order)
請幫助我,我不知道如何使用LINQ
歡迎StackOverflow上:如果您發佈的代碼,XML或數據樣本,** **請在高亮文本編輯器的線,然後點擊編輯器工具欄上的「代碼示例」按鈕(「{}」)可以很好地進行格式化和語法高亮顯示! – 2012-04-13 06:10:49
這裏我想插入數據在表中從「標籤」objject列表中給出的查詢..我正在使用sql compact 3.5 .. – 2012-04-13 06:56:32
使用標籤對象我想編寫Sql compact查詢以將數據插入到數據庫中; INSERT INTO TUPLE_MAP(TagId,ParentTagId,ParentTagname,MinOccur,MaxOccur,Order) VALUES(TagIdToInsert,ParentTagId,ParentTagname,MinOccur,MaxOccur,訂單) 其中所有「標籤」對象數據用於上述 – 2012-04-13 07:14:26