I am making a a WindowsFormsApp and I have to get by a ComboBox, idCategory that is the primary key of Table Category. The thing is this is a foreign key in Table Contract and I don't know how to make the query in C# since it looks is a different way.
cmdContract.CommandText = "Insert into Contract(idCategory, ContractNumber) VALUES" +
"((Select idCategory from Category where idCategory=" + idCategory + "),@ContractNumber");
I have another table that doesn't have foreign keys and works good, but with this one, Contract, it doesn't insert anything