I need to read the values of a column called Code_Article and put them, but when the column is still empty, I run and give the error: p>
The object reference was not defined as an instance of a object.
Here is my code:
conn.Open();
SqlCommand cmd6 = new SqlCommand("SELECT Code_Article FROM ArticleBarCode", conn);
Int32 codeexistente = (Int32)cmd6.ExecuteScalar();
conn.Close();
What can I change in the code for when the column is empty, do not give error, but return for example 0?