com = new SqlCommand("SELECT pro_name from products where pro_name= @idP", con);
SqlParameter param = new SqlParameter
{
ParameterName = "@idP",
Value = proNames[i]
};
com.Parameters.Add(param);
it works fine with integer type but for string its not working it give error
System.Data.SqlClient.SqlException: 'The parameterized query '(@idP nvarchar(4000))SELECT pro_name from products where pro_nam' expects the parameter '@idP', which was not supplied.'