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.'
proNames[i]must be replaced with actual value (possibly simplified/sanitized) and actual call to DB shown (as frequently such problems come from constructing one query but using some other one to make actual call)