I do not see what I am doing wrong, as the files are in the correct order. In this case, it is:
- BaseDAO.fs
- CreateDatabase.fs
They are in the same namespace, but even when I used them in different modules and opened the module in CreateDatabasethe same error.
Error:
Error 1 The value or constructor 'execNonQuery' is not defined
I am trying to inherit BaseDAOand use an element that will be shared across multiple files, and I do not understand why I received the error above.
namespace RestaurantServiceDAO
open MySql.Data.MySqlClient
type BaseDAO() =
let connString = @"Server=localhost;Database=mysql;Uid=root;Pwd=$$$$;"
let conn = new MySqlConnection(connString)
member self.execNonQuery(sqlStr) =
conn.Open()
let comm = new MySqlCommand(sqlStr, conn, CommandTimeout = 10)
comm.ExecuteNonQuery |> ignore
comm.Dispose |> ignore
The type inheriting here is execNonQuerynot defined.
namespace RestaurantServiceDAO
open MySql.Data.MySqlClient
type CreateDatabase() =
inherit BaseDAO()
let createRestaurantTable conn =
execNonQuery "CREATE TABLE restaurant(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), cur_timestamp TIMESTAMP(8))"
source
share