in VB I have this code,
Dim dataset As System.Data.Odbc.OdbcDataReader = cmd.ExecuteReader()
which creates an object with the results of cmd.Execute Reader of type OdbcDataReader and assigns it to a dataset. cmd is a System.Data.Odbc.OdbcCommand object.
In f # I tried
let dataset = new System.Data.Odbc.OdbcDataReader
dataset <- cmd.ExecuteReader
as well as a mutable version of the dataset, I also tried
let dataset = cmd.ExecuteReader
The first errors in the second instance of the dataset, saying: "Incomplete structured construction at or to this point in the expression," adding a semicolon does not help.
Second error on let; saying that the expression is not complete. How to create an object with the result of System.Data.Odbc.OdbcCommand.ExecuteReader?
edit:
More code
let dataConnection = new System.Data.Odbc.OdbcConnection()
dataConnection.ConnectionString <- "*******"
let mystring = "SQL query"
let cmd = new System.Data.Odbc.OdbcCommand(mystring, dataConnection)
let odbcConnectFunction =
try
dataConnection.Open()
System.Console.WriteLine "connected"
//let dataset = new System.Data.Odbc.OdbcDataReader
let dataset = cmd.ExecuteReader()
finally
dataConnection.Close()
source
share