我寫了這個SQL查詢:如果條件與空結果查詢
SqlCommand cmd2 = new SqlCommand();
cmd2.Connection = new SqlConnection(Class1.CnnStr);
cmd2.CommandText = "SELECT MAX(Code) FROM Table WHERE [email protected] ";
cmd2.Connection.Open();
cmd2.Parameters.AddWithValue("@Number", Hidden_txt.Text);
cmd2.ExecuteNonQuery();
,我想補充一些if條件,如:
if (cmd2.ExecuteScalar()=="Null")
{....}
我怎麼能如果條件添加當我的查詢沒有答案?