By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,685 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

cannot load index value from mysql database

P: n/a
Hi

I am trying to right a script to keep a local copy of my mysql
database in a local access file. I was able to do this in Access
visual basic, but cannot get it to work in python.

The procedure works by storing the last index value after each
update. Then I do a quarry for all records with a index value bigger
the the last one stored.

In python when I try to get the index value, ID it gives me a
keyword. I know the firled exist because I am doing the following
querry
Here is the code,
Help!!!!!!

engine = win32com.client.Dispatch("DAO.DBEngine.36")
self.db=engine.OpenDatabase(r"w:\consulting\custom-web-stats-
project\web-stat.mdb")
access = self.db.OpenRecordset("select * from local_web_stat
where 1")
temp = self.db.OpenRecordset("select * from lastid where 1")
self.lastid=temp.Fields("lastid").Value

#open mysql
conn = MySQLdb.connect (".")
cursor = conn.cursor (MySQLdb.cursors.DictCursor)
cursor.execute ("SELECT * FROM web_stat where
ID>"+str(self.lastid))
result_set = cursor.fetchall ()

for row in result_set:
last=row["ID"]b (this does not work why???????)
access.Edit()

access.Fields("customer").value= row["customer"]
t=row["time"]
print t

access.Fields("Time").value=t
access.Fields("phrase").value= row["phrase"]
access.Fields("key_word_phrase").value =
row["key_word_phrase"]
access.Fields("from_server").value = row["from_server"]
access.Fields("path_name").value = row["path_name"]
id = row["PageID"]
print id
g=str(id)
k=int(g)
access.Fields("PageID").value=k
access.Fields("server_name").value = row["server_name"]
access.Fields("file_name").value = row["file_name"]

access.Update()
temp.Edit()
temp.Fields("lastid").Value=k
temp.Update()
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.