1.如果希望返回数据流,可以使用ExecuteReader方法来返回一个DataReader对象; 2.对于SQL数据源,如果将CommandText属性置为合法的带有FOR XML子句的T—SQL语句,可以使用SqlCommand对象的ExecuteXmlReader方法返回一个XmlReader对象。 3.如果希望返回单个值,使用ExecuteScalar方法; 4.执行没有返回值的SQL语句时,调用ExecuteNonQuary方法。 例如: SqlDataReader dr=sqlcmd.ExecuteReader(); sqlcmd.CommandText=”select * from Books for xml auto,xmldata”; XmlReader xr=sqlcmd.ExecuteXmlReader(); Sqlcmd.CommandText=”delete * from Books where Price=10”; Sqlcmd.ExecuteNonReader(); Sqlcmd.CommandText=”select count(*) from Books”; Sqlcmd.ExecuteScalar();