定义: SqlCommand cmd = new SqlCommand();//或者SqlCommand cmd = new SqlConnection().CreateCommand(); 注意参数
cmd.CommandType = CommandType.StoredProcedure; //存储过程
cmd.CommandType = CommandType.Text; //sql语句
cmd.CommandType = CommandType.TableDirect; System.Data.CommandType.TableDirect表示要执行的是表,此时,cmd.CommandText 的值应该是要查询表的的名称。查询结果返回的是整个表。