ExecuteReader模型里的for循环能用foreach代替吗

http://img1.mukewang.com/5a94c1250001559604600281.jpg

我尝试了一下,不知为何不可以,只输出了一个命名空间

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                       
                        while (reader.Read())
                        {
                            foreach(object item in reader)
                            {
                                Console.Write(item.ToString());
                            }
                            Console.WriteLine();
                        }
                    }


qq_杀意隆_0
浏览 952回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP