问题出在SqlCommand中没有定义SqlConnection属性,
即代码为:SqlCommand cmd= new SqlCommand();
以上问题出在没有将属性加入new SqlCommand后的()中