import win32com.client
import pywintypes
from isql2 import Aisql
import cmd
def connect(dbfn):
    try:
        constr=r"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+dbfn+";Persist Security Info=False"
        print constr
        db=Aisql()
        db.dbConnect("",constr)
        return(db)
    except pywintypes.com_error,e:
        print e[0],e[1]
    except:
        print "error"
if __name__=="__main__":
    dbfn=r"J:\nb\cs\access2000\data.mdb"
    db=connect(dbfn)
    if db!=None:
        for cmd1 in cmd.cmds:
            try:
                r=db.execQuery(cmd1)
            except pywintypes.com_error,e:
                if e[0]==-2147352567:
                    pass
                else:
                    print e[0],e[1]
    else:
        print "error open"
