Last post Dec 10, 2013 04:20 AM by Happy Chen - MSFT
Dec 08, 2013 08:01 AM|kckcOng|LINK
why in this case i cant use has row keyword? i want to search at bright table and do the if else statement.
using (SqlConnection conStrstock8 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString()))
string sqlupStockselect8 = "Select ProductID,ProductColorType,ProductSize WHERE ProductID=@pid AND ProductColorType=@protType AND ProductSize=@size";
using (SqlCommand cmdupstock8 = new SqlCommand(sqlupStockselect8, conStrstock8))
cmdupstock8.Parameters.AddWithValue("@size", " XS");
SqlDataReader myReader = cmdupstock8.ExecuteReader();
Dec 08, 2013 10:23 AM|oned_gk|LINK
Dec 10, 2013 04:20 AM|Happy Chen - MSFT|LINK
hi kckcOng ,
Straight off the bat I'd say readability. We all know that Read() will return False if there are no more rows to fetch, but Reader.HasRows is much more telling as to what it does than
i would suggest you read the follow link for more information:
sqldatareader: Hasrows vs Read()
Hope it helps you.