title: Insert new record with composite primary key, which consists of two foreign keys from different tables
body: <p>Please help me figure out how to Insert new record with composite primary key, which consists of two foreign keys from different tables.
  I am working in C#, WPF if that matters. </p>
  
  <p>I have three tables: Sales, SaleItem, Item. </p>
  
  <pre><code>CREATE TABLE [dbo].[Sales] (
      [saleID]     INT      IDENTITY (1, 1) NOT NULL,
      [saleTime]   DATETIME NOT NULL,
      [customerID] INT      NULL,
      [TIN]        INT      NOT NULL,
      CONSTRAINT [PK_Sales] PRIMARY KEY CLUSTERED ([saleID] ASC),
      CONSTRAINT [FK_Sales_Customers] FOREIGN KEY ([customerID]) REFERENCES [dbo].[Customers] ([customerID]),
      CONSTRAINT [FK_Sales_Company] FOREIGN KEY ([TIN]) REFERENCES [dbo].[Company] ([TIN])
  );
  
  
  
  CREATE TABLE [dbo].[Item] (
      [ItemSKU]     INT           IDENTITY (1, 1) NOT NULL,
      [itemName]    NVARCHAR (50) NOT NULL,
      [volume]      FLOAT (53)    NOT NULL,
      [measureUnit] NVARCHAR (50) NOT NULL,
      [producer]    NVARCHAR (50) NOT NULL,
      [supplierID]  INT           NOT NULL,
      [retailPrice] NUMERIC (18)  NOT NULL,
      CONSTRAINT [PK_Item] PRIMARY KEY CLUSTERED ([ItemSKU] ASC),
      CONSTRAINT [FK_Item_Suppliers] FOREIGN KEY ([supplierID]) REFERENCES [dbo].[Suppliers] ([supplierID])
  );
  
   CREATE TABLE [dbo].[SaleItem] (
          [saleID]   INT IDENTITY (1, 1) NOT NULL,
          [itemSKU]  INT NOT NULL,
          [quantity] INT NOT NULL,
          CONSTRAINT [PK_SaleItem] PRIMARY KEY CLUSTERED ([saleID] ASC, [itemSKU] ASC),
          CONSTRAINT [FK_SaleItem_Sales] FOREIGN KEY ([saleID]) REFERENCES [dbo].[Sales] ([saleID]),
          CONSTRAINT [FK_SaleItem_Item] FOREIGN KEY ([itemSKU]) REFERENCES [dbo].[Item] ([ItemSKU])
      );
  </code></pre>
  
  <p>I want to insert a new record into SaleItem table (the third one) where saleID is the last ID recorded in Sales table and ItemSKU which is equal to the value I get from another window. </p>
  
  <p>I want these values: </p>
  
  <pre><code>SaleID = SELECT TOP 1 saleID FROM Sales ORDER BY saleID DESC";
  ItemSKU = "SELECT itemName FROM Item WHERE ItemSKU = @sku";
  </code></pre>
  
  <p>I think I must do it in one query but I have no idea how. 
  Can you please give me a hint? I</p>