lundi 18 décembre 2017

How to use inline c# if instead of using long c# if statement

How to use single line if statement that reduce the number of lines of code for these kind of coding

        if (string.IsNullOrEmpty(txtpictext.Text))
        {
            Cmd.Parameters.AddWithValue("@pictext", DBNull.Value);
        }
        else
        {
            Cmd.Parameters.AddWithValue("@pictext, txtpictext.Text);
        }

        Conn.Open();
        Cmd.ExecuteNonQuery();

Aucun commentaire:

Enregistrer un commentaire