F# and ADO.NET to Connect To Access 2007 -
I am very new to F #, and the simplest way I can connect to Access 2007 using System 2007 Was trying to find. OleDb. I did this with C #, but I can not understand how to change the syntax to F #. The following is what I still know:
# Open Systems. Windows. Open Forms System. Data Ole db open system Data Edocon = New Oledbikonation () Give DTAB = New DataTil (ADOCon.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C: \ User \ ... mdb" I know that the syntax for connection string is incorrect, and I can not understand how to add the Oleadata adapter and Olecommdbuilder. Does anyone know that there is a straight forward example of opening connections with #Light? Thanks, in advance!
It is not F # to do this, but it works.
Open System.Data Open System.Data. OLDB CMD = New Ondebee Commands ("Selection + from Tab 1"); Let conn = new OleDbConnection (@ "provider = Microsoft.ACE.OLEDB.12.0; data source = C: \ Temp \ Database1.mdb; constant security info = false;") conn.Open (); CMD. Connection and lieutenant; - Who; (Cmd.ExecuteReader ()) (funny reader -> if using (reader.HasRows) (printfn "query:% s" cmd.CommandText while (reader.Read ()) (id = reader.GETInt32 ( 0) Let's tmp = reader.getString (1) printfn "% d% s" id tmp) (printfn "empty result")) conn.Close (); ;;
Comments
Post a Comment