// Code from Hansen and Rischel: Functional Programming using F# 16/12 2012 // Chapter 11: Sequences // Code from the Section 11.8: Creating the tables in the product register. // It is assumed that a suitable (empty) database ProductRegister is already created. // The following part created empty Part and PartList tables open System.Configuration open System.Data open System.Data.SqlClient let connString = @"Data Source=IMM-NBMRH\SQLEXPRESS; Initial Catalog=ProductRegister; Integrated Security=True";; let conn = new SqlConnection(connString) conn.Open();; let execNonQuery conn s = let comm = new SqlCommand(s, conn, CommandTimeout = 10) comm.ExecuteNonQuery() |> ignore;; execNonQuery conn "CREATE TABLE Part ( PartId int NOT NULL, PartName varchar(50) NOT NULL, IsBasic bit NOT NULL, PRIMARY KEY (PartId))";; execNonQuery conn "CREATE TABLE PartsList ( PartsListId int NOT NULL, PartId int NOT NULL, Quantity int NOT NULL, PRIMARY KEY (PartsListId, PartId))";;