KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm just starting to learn F#. I wrote this F#/ADO.NET code last night. In what ways would you improve the syntax - make it feel like idiomatic F#? let cn = new OleDbConnection(cnstr) let sql = "SELECT * FROM People" let da = new OleDbDataAdapter(new OleDbCommand(sql, cn)) let ds = new DataSet() cn.Open() let i = da.Fill(ds) let rowCol = ds.Tables.[0].Rows let rowCount = rowCol.Count printfn "%A" rowCount for i in 0 .. (rowCount - 1) do let row:DataRow = rowCol.[i] printfn "%A" row.["LastName"] Note: I did find the syntax checker did not like rowCol.[i].["LastName"] What is the proper way to handle dual-indexers? I had to break up the code over two lines. Also If I hadn't gone down the DataSet route and used a SqlDataReader that loaded its data into F# records. What collection structure should I use for containing the records? The standard .NET List<>?
Tags (comma-separated)
Save Edits
Cancel