c# - 插入多条记录以获取所有id时如何在c#中使用输出子句?
问题描述
在我的 c# 代码中,我有这个功能
public static List<T> SELECT<T>(string command, Func<SqlDataReader, T> f, Dictionary<string, object> h)
{
SqlConnection myConnection = new SqlConnection(mySetting.ConnectionString);
myConnection.Open();
SqlDataReader myReader = null;
SqlCommand myCommand = new SqlCommand(command, myConnection);
foreach (KeyValuePair<string, object> entry in h)
{
myCommand.Parameters.AddWithValue(entry.Key, entry.Value);
}
myReader = myCommand.ExecuteReader();
List<T> lst = new List<T>();
while (myReader.Read())
{
lst.Add(f(myReader));
}
myConnection.Close();
return lst;
}
但是如何使用其中的输出子句来获取表示 id 列表的整数数组?这是否支持临时表?
解决方案
推荐阅读
- excel - 为什么我不能使用 VBA 更改活动的 Excel 工作表
- datatable - 如果完整行包含 dt 为零,则删除某些行
- asp.net - 浏览器的asp net back按钮导致找不到页面
- scala - 使用 scala 正则表达式提取
- sql - SQL 将列配对一次
- php - PHPDoc - 在函数中没有参数的情况下记录@param?
- python - Python mock 修补类实例中的方法
- ruby-on-rails - 在创建复合唯一索引时提供文本列长度
- visual-studio-code - 无法设置 Visual Studio 代码调试器
- google-cloud-platform - [Spring Cloud][PubSub] 从 pubsub 读取 avro 消息