http://dotnetslackers.com/articles/csharp/WritingAnActiveXControlInCSharp.aspx
Blogged with the Flock Browser
from win32com.client import Dispatch as CreateObject
conn = CreateObject("ADODB.Connection")
mdb = r"C:\northwind.mdb"
conn.Open("Driver={Microsoft Access Driver (*.mdb)}; DBQ=%s;"%mdb)
def execRequest(sql):
r,t = conn.Execute(sql )
cust = "<table>\n"
while not r.EOF:
s = "<tr>"
for item in r.Fields:
if item.Name == "ContactName" or item.Name == "Address":
s+= "<td>%s</td>"%(item.Value)
s += "</tr>\n"
cust += s
r.MoveNext()
cust += "</table>\n"
return cust
cust = execRequest("select * from customers")
conn.Close()
#light
open System
open System.Management
let getLogicalDisk () =
let query = "select * from win32_logicaldisk where drivetype = '3'"
let objMgt = new ManagementObjectSearcher(query)
let result = objMgt.Get()
for info in result do
let caption = info.GetPropertyValue("Caption").ToString()
let size = info.GetPropertyValue("Size").ToString()
printf "%2s : %15s Ko\n" caption size
getLogicalDisk ()
read_line ()
#light
open System
let print x = printfn "%A" x
let sub a b = a - b
let halfway a b =
let dif = b -a
let mid = dif/2
let z = mid + a
z
let y = (fun x y -> x + y) 1 2
let rec fib x =
match x with
| 1 -> 1
| 2 -> 1
| x -> fib (x-1) + fib (x-2)
let UnAnApres =
DateTime.Now + new TimeSpan(365,0,0,0,0)
let print_List l =
List.iter print_string l
print_string "\n"
let shortHand = ["apples"; "pairs"]
shortHand |> printf "%A"
read_line ()