我想逐行阅读就是这样 [英] i want to read row by row is it right like that

查看:93
本文介绍了我想逐行阅读就是这样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public static List<int> AssignmenBlock_IDs()
   {
       List<int> Block_IDsList = new List<int>();

       SqlConnection connecetion = ConnectingDatabase.GetConnection();
       string command = "SELECT ID FROM Assignment";
       SqlCommand commn = new SqlCommand(command, connecetion);


       SqlDataReader reader = commn.ExecuteReader();

       while (reader.Read())
       {
           Block_IDsList.Add(reader.GetInt32(0));
       }

       connecetion.Close();
       return Block_IDsList;

   }

将每个索引包含在每行的id中

will each index in the consist of id of each row

推荐答案

测试它,但是在快速查看是的,它应该显示列表中每行的ID值。
Test it, but at a quick look yes it should show the ID value for each row in your list.


这篇关于我想逐行阅读就是这样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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