I have created a product table to put features of product and when I run the code shown below, I get an error
System.InvalidCastException: Byte cannot converted to Byte[]
What is wrong with that code?
int m_syscode = 10;
string m_code1 = "mcode1";
string m_name = "mcode1";
string m_shortname = "mcode1";
string parentcode = "mcode1";
byte m_abstract = 1;
string category = "mcode1";
byte is_active = 0;
string sql = $"INSERT INTO PRODUCT (M_SYSCODE, M_CODE, M_NAME, M_SHORTNAME, M_PARENTCODE, M_ABSTRACT, M_CATEGORY, IS_ACTIVE) VALUES(@m_syscode, @m_code1, @m_name, @m_shortname, @parentcode, @m_abstract, @category, @is_active )";
SqlCommand command = new SqlCommand(sql, connection);
command.Parameters.Add("@m_syscode", System.Data.SqlDbType.Int, 4).Value = m_syscode;
command.Parameters.Add("@m_code1", System.Data.SqlDbType.VarChar, 15).Value = m_code1;
command.Parameters.Add("@m_name", System.Data.SqlDbType.VarChar, 25).Value = m_name;
command.Parameters.Add("@m_shortname", System.Data.SqlDbType.VarChar, 10).Value = m_shortname;
command.Parameters.Add("@parentcode", System.Data.SqlDbType.VarChar, 15).Value = parentcode;
command.Parameters.Add("@m_abstract", System.Data.SqlDbType.Binary, 1).Value = m_abstract;
command.Parameters.Add("@category", System.Data.SqlDbType.VarChar, 12).Value = category;
command.Parameters.Add("@is_active", System.Data.SqlDbType.Binary, 1).Value = is_active;
int result = command.ExecuteNonQuery();
return result.ToString();
