Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 152703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:40:15+00:00 2026-05-11T09:40:15+00:00

[Edit 2: More information and debugging in answer below…] I’m writing a python script

  • 0

[Edit 2: More information and debugging in answer below…]

I’m writing a python script to export MS Access databases into a series of text files to allow for more meaningful version control (I know – why Access? Why aren’t I using existing solutions? Let’s just say the restrictions aren’t of a technical nature).

I’ve successfully exported the full contents and structure of the database using ADO and ADOX via the comtypes library, but I’m getting a problem re-importing the data.

I’m exporting the contents of each table into a text file with a list on each line, like so:

[-9, u'No reply'] [1, u'My home is as clean and comfortable as I want'] [2, u'My home could be more clean or comfortable than it is'] [3, u'My home is not at all clean or comfortable'] 

And the following function to import the said file:

import os import sys import datetime import comtypes.client as client from ADOconsts import * from access_consts import *  class Db:     def create_table_contents(self, verbosity = 0):         conn = client.CreateObject('ADODB.Connection')         rs = client.CreateObject('ADODB.Recordset')         conn.ConnectionString = self.new_con_string         conn.Open()         for fname in os.listdir(self.file_path):             if fname.startswith('Table_'):                 tname = fname[6:-4]                 if verbosity > 0:                     print 'Filling table %s.' % tname                 conn.Execute('DELETE * FROM [%s];' % tname)                 rs.Open('SELECT * FROM [%s];' % tname, conn,                         adOpenDynamic, adLockOptimistic)                 f = open(self.file_path + os.path.sep + fname, 'r')                 data = f.readline()                 print repr(data)                 while data != '':                     data = eval(data.strip())                     print data[0]                     print rs.Fields.Count                     rs.AddNew()                     for i in range(rs.Fields.Count):                         if verbosity > 1:                             print 'Into field %s (type %s) insert value %s.' % (                                 rs.Fields[i].Name, str(rs.Fields[i].Type),                                 data[i])                         rs.Fields[i].Value = data[i]                     data = f.readline()                     print repr(data)                     rs.Update()                 rs.Close()         conn.Close() 

Everything works fine except that numerical values (double and int) are being inserted as zeros. Any ideas on whether the problem is with my code, eval, comtypes, or ADO?

Edit: I’ve fixed the problem with inserting numbers – casting them as strings(!) seems to solve the problem for both double and integer fields.

However, I now have a different issue that had previously been obscured by the above: the first field in every row is being set to 0 regardless of data type… Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:40:16+00:00Added an answer on May 11, 2026 at 9:40 am

    And found an answer.

        rs = client.CreateObject('ADODB.Recordset') 

    Needs to be:

        rs = client.CreateObject('ADODB.Recordset', dynamic=True) 

    Now I just need to look into why. Just hope this question saves someone else a few hours…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 113k
  • Answers 113k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I created a project (Rails 2.3.2, Ruby 1.9.1 MySQL 5.0)… May 11, 2026 at 10:03 pm
  • Editorial Team
    Editorial Team added an answer To have a single app that works on both OS… May 11, 2026 at 10:03 pm
  • Editorial Team
    Editorial Team added an answer you may want to enable strict type checks by using:… May 11, 2026 at 10:03 pm

Related Questions

[Edit 2: More information and debugging in answer below...] I'm writing a python script
I've been working on an embedded C/C++ project recently using the shell in Tornado
Okay, I will shortly be starting down the path of windows mobile development. I
I have a command-line utility that gets quite a bit of downloads from my
I know that some companies allow you to install their products on build machines

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.