469,906 Members | 2,224 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,906 developers. It's quick & easy.

cannot load index value from mysql database

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
0 845

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Kevin | last post: by
9 posts views Thread by John Kirksey | last post: by
3 posts views Thread by ewunia | last post: by
4 posts views Thread by CPD | last post: by
1 post views Thread by edfialk | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.