How to create a constraint with multiple columns using OLEdb

Pat Hanks 61 Reputation points
2023-01-02T21:45:21.62+00:00

The use case is for an Access database using OLEdb via C#. I need to build the tables or alter afterward to establish the relationships between a couple tables. I am able to get the relationship with one column in the table to another column in a foreign table. I am using this syntax for the constraint, CONSTRAINT FK_indexname REFERENCES tablename (columnName) ON DELETE CASCADE. However I need to have a single column (ID) to multiple columns in a foreign table. The use is I have a item table for all the items used and a recipe table where several columns will reference the item table. Here is what I built in Access that I need to understand the proper syntax to use in my code.

275450-relationship.gif

Thanks for your help

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
7,010 questions
Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
729 questions
{count} votes