On Jul 2, 3:29 pm, Tim Golden <[EMAIL PROTECTED]> wrote:
> Iain King wrote:
> > Hi.  I'm using the win32 module to access an Access database, but I'm
> > running into the File Sharing lock count as 
> > inhttp://support.microsoft.com/kb/815281
> > The solution I'd like to use is the one where you can temporarily
> > override the setting using (if we were in VB):
>
> > DAO.DBEngine.SetOption dbmaxlocksperfile,15000
>
> Really hurried answer:
>
> <code>
> import win32com.client
>
> dao = win32com.client.gencache.EnsureDispatch ("DAO.DBEngine.36")
> dao.SetOption (Option=win32com.client.constants.dbMaxLocksPerFile, 
> Value=15000)
>
> </code>
> TJG

Thanks.  I found this: 
http://blogs.msdn.com/michkap/archive/2007/07/13/3849288.aspx
which outlines some difference between DAO and ADO, including:
"Capability to set and change Jet options without making registry
changes (works in DAO through DBEngine.GetOption and
DBEngine.SetOption, fails in ADO, which has no such analogue)."

Now, I'm pretty sure I tried to use DAO before and failed to get it to
work, but maybe you could look at my code and suggest the DAO
equivalent?

---

self._connection = win32com.client.Dispatch(r'ADODB.Connection')
self._DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE='+dbfile+';'

self._connection.Open(self._DSN)
rs = win32com.client.Dispatch(r'ADODB.Recordset')
query = 'SELECT '+field+' FROM '+self.__TABLE
rs.Open(query, self._connection, 1, 3)
while not rs.EOF:
    v = function(rs.Fields.Item(0).Value)
    if v != RETAIN_VALUE:
        rs.Fields.Item(0).Value = v
    rs.MoveNext()
rs.Close()

---

aTdHvAaNnKcSe,
Iain
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to