473,750 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple mx.ODBC prob seeks simple answer


Hello all,
I'm having trouble inserting an SQL selection into a new MS Access table. I
get a parameter error on my insert statement when I try this (see below for
code and error msg). I'm not sure if 'insert' or 'update' is the route I
should be taking.

CODE:
#Import Pythond Standard Library Modules
import win32com.client , sys, os, string, copy, glob
import mx.ODBC.Windows as odbc

# Create the Geoprocessor Object
gp = win32com.client .Dispatch("esri Geoprocessing.G pDispatch.1")
gp.overwriteout put = 1

# Variables
tempspace = "C:\Documen ts and Settings\corr1g re\Desktop\Work space\DBFs &
Shapefiles\TEST .mdb"
workspace = string.replace( tempspace,"\\", "/")
worksheet1 = "Mower_I"
worksheet2 = "Mower_II"

#Conection to Access
driv = 'DRIVER={Micros oft Access Driver (*.mdb)};DBQ='+ workspace
conn = odbc.DriverConn ect(driv)
curse = conn.cursor()

#Drop Tables if they already exist
try:
curse.execute(' Drop table Table_I')
curse.execute(' Drop table Table_II')
curse.execute(' Drop table Checker')
except:
pass
#Create a New Tables
curse.execute(' Create table Table_I (TISCODE TEXT(12), EXISTSIN
TEXT(4),STATUS TEXT(3),NOTES TEXT(50))')
curse.execute(' Create table Table_II(TISCOD E TEXT(12), EXISTSIN TEXT(4))')
curse.execute(' Create table Checker (TISCODE TEXT(12), EXISTSIN
TEXT(4),STATUS TEXT(3),NOTES TEXT(50))')
conn.commit()

#Upload DBF 1 as a List of Tuples: Returns tuple as ('1021500000',' BMP')
sql = 'SELECT TISCODE,EXISTSI N from '+worksheet2
curse.execute(s ql)
x = curse.fetchall( )

#Put the fetched Data into Table_II
for i in x:
curse.execute(' Insert into Table_II (TISCODE,EXISTS IN) values
(%s,%s)'%(i[0],i[1]))
conn.commit()
conn.close()

TRACEBACK ERROR MSG:
Traceback (most recent call last):
File "C:/Documents and Settings/corr1gre/Desktop/Workspace/Python/ArcGIS
Python/ExistenceChecke r and Update/Access Double Checker/Access_SQL.py",
line 40, in ?
curse.execute(' Insert into Table_II (TISCODE,EXISTS IN) values
(%s,%s)'%(i[0],i[1]))
ProgrammingErro r: ('07001', -3010, '[Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 1.', 4612)
--
View this message in context: http://www.nabble.com/Simple-mx.ODBC....html#a9871804
Sent from the Python - python-list mailing list archive at Nabble.com.

Apr 6 '07 #1
0 1249

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1982
by: Chris Thiessen | last post by:
Hi, I'm Chris Thiessen. My partner and I need your help. We're finishing up what we think is a great compliment to the core Java API's, but we need feedback from other developers. We'd really appreciate it if you could spare 5-10 minutes to fill out a survey and help us shape our creation to your needs. Those who do so before November 1 will get a free license when the product is released. The high-points:
1
2091
by: lighthammer | last post by:
Hi I think i have a very unique issue .... Running 2 machines Win2000 / WinXP Both have Sql / Service packs Identical ODBC Setup The issue is as follows :
8
3487
by: Philip Wright | last post by:
I am trying to connect to a DB2 v7.2 database from Lotus 123 v9.8 on a Windows XP Pro machine. I have the Software Development Client installed on the XP machine and have run the Client Configuration Assistant and registered the SAMPLE and my TEST databases with the ODBC Administrator as System DSN data sources. Everything seems fine, but when I try to connect to "External Tables" through 123 my DB2 databases are not listed under available...
11
2579
by: Franz Seidl | last post by:
Hello! we (our computing school) is searching a ODBC-Driver for Windows XP. Is there any driver, which is free of charge? (you know, nearly every school (at least here in Germany) has not enough money for this "lesser" things...) Best regards, Franz Seidl
2
1588
by: Andre L via AccessMonster.com | last post by:
We run numerous Access reports which we auto export as .rtfs to a share. We also have numerous Excel sheets. Each month 10 or more of these reports are combined into deprtmental monthly packets. We were given Adobe Acrobat Professional 6 and told it could build the packet for us in an automated fashion....ie it could convert the 10 or so reports to PDF format and merge them into one file. Manually I found this simple enough to do....
28
2725
by: Vishal Naidu | last post by:
i m new to the C world... i ve been told by my instructors not to use goto stmt.. but no one could give me a satisfactory answer as to why it is so.. plz help me out of this dilemma, coz i use a lot of goto in my codes....
7
2853
by: Arrun S | last post by:
Hi I don't know how to access the ODBC API through C#. The VS.NET provides OLEDB Data Provider but not ODBC E.g., select * from tbl where id= To get the data type (description) of the column 'id', the ODBC provides a function 'SQLDescribeParam()'. But, I don't know how to access this function through C#.Could anyone help me TIA Arrun
4
6386
by: StefanSerena | last post by:
Hi I'm running Windows 2000 and Office 2003. I want to copy tables from an unknown database format into Access 2.0 and I could do it quite easily if it weren't for the fact that recent ODBC-drivers aren't capable of writing into an Access 2.0 database (only reading). I do have the old Access 2.0 disks including odbc-driver, but it doesn't install on my machine (probably because the newer ones are installed...). And yes, I know that...
2
4151
by: Brad | last post by:
Where is the connection string stored for a simple Crystal Report Application. What I am trying to do is: 1. Create a simple report from a Firebird database using an ODBC connection 2. Need to compile and deploy to a production environment 3. How to set the data connection so it is can connect to the production database which is different to the dev database...this must be able to be done on the production system after compiling on the...
0
9000
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9396
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4713
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2804
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.