请问ExecuteReader()是什么意思?

ExecuteReader()----执行命名,返回一个类型化的 IDataReader
简化代码如下:

using (SqlConnection conn = new SqlConnection(connString))
            {
                string sqlString = "proc_InsertNewContact";
                SqlCommand sqlCmd = new SqlCommand(sqlString,conn);
                sqlCmd.CommandType = CommandType.StoredProcedure;

                sqlCmd.Parameters.AddWithValue("@AddressLine1", mAddressLine1);
                conn.Open();
                SqlDataAdapter sqlreader = sqlCmd.ExecuteReader();
               
                conn.Close();
            }

posted @ 2011-04-11 10:16  勇气  阅读(1068)  评论(0编辑  收藏  举报