1
I need to read the values of a column called Code_article and place them, only when the column is still empty, I execute and immediately gives the error:
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 I can change in the code for when the column is empty, do not give error, but return for example 0 ?
Do you still have the problem in your code? Because SQL returns a list or no value, what is the purpose you need to do in your code?
– novic