如何使用linq编写查询? [英] How to write query using linq?

查看:84
本文介绍了如何使用linq编写查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何查询转换为使用实体查询?

我在c#中创建数据库并将旧数据库复制到新数据库。但我想使用实体进行复制。如何转换使用实体此查询?



我尝试过:



How to query convert to use entity query ?
I create database in c# and old database copy to new database.But I want to make copies using entities. How to convert use entities this query?

What I have tried:

private static void TableCopy() {
foreach (var tablename in Settings.Default.Student){
var query= @"Insert ınto" + StudentDatabaseName + ".tbl" + tablename +"select * from StudentChangeDatabaseName +"tbl"+tableName);
}

推荐答案

看看这个回答:使用Linq-to-SQL插入/选择 [ ^ ]

此处描述了另一种方式: .net - 如何在LINQ中INSERT INTO table1(...)SELECT(...)FROM table2?[ ^ ]
Take a look at this answer: Insert/Select with Linq-To-SQL[^]
Another way is described here: .net - How to do "INSERT INTO table1 (...) SELECT (...) FROM table2" in LINQ?[^]


这篇关于如何使用linq编写查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆