472,975 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,975 software developers and data experts.

DB Query Parse Hangup

Hi There,

I have been working on this script, and the part that this issue that
I have occurs in is when iterating through some results from the db,
asking the admin input to delete the entry or not - everything works
fine up until the last entry, then it bombs out. I know why - but I am
not quite sure how to fix it:

The Code:

select_statement = "SELECT source, destination FROM mail.forwardings
WHERE destination = '%s'" % e_mail

result = db_cursor.execute(select_statement)
if result >= 1:
aliasLine = 0
number = result - 1
while aliasLine <= number:
db_cursor.execute(select_statement)
answer = db_cursor.fetchall()
answer_1 = answer[aliasLine]
aliasLine = aliasLine + 1
print '%s is still linked to %s.' % (answer_1[0], answer_1[1])
#to_edit = raw_input("Please provide one of the above mentioned E-
Mail Aliases to edit: ")
to_do = str.lower(raw_input("Would you like to Delete(D) or
Modify(M) the alias? [D/M] "))
delete = 'd'
modify = 'm'
if to_do == delete:
del_statement = "DELETE FROM forwardings WHERE source = '%s'" %
answer_1[0]
db_cursor.execute(del_statement)
print "Alias '%s', has been successfully deleted." % answer_1[0]
elif to_do == modify:
print "WILL BE MODIFIED"

any help will be much appreciated.

Thank you!
-- Merrigan
Dec 14 '07 #1
1 1007
En Fri, 14 Dec 2007 13:17:32 -0300, Merrigan <ch***********@gmail.com>
escribi�:
I have been working on this script, and the part that this issue that
I have occurs in is when iterating through some results from the db,
asking the admin input to delete the entry or not - everything works
fine up until the last entry, then it bombs out. I know why - but I am
not quite sure how to fix it:
You could get some help if you explain what you mean by "it bombs out"
(the program stops with an exception? post the full traceback), and since
you know "why", telling it would be a good thing too.

--
Gabriel Genellina

Dec 17 '07 #2

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

Similar topics

8
by: Polar | last post by:
I am having troubles finding the parse error in this script. I've been checking for weeks. I am too new to the subject I guess. I am trying to show a readord and them have a form at the bottom...
9
by: Mike Bridge | last post by:
I am using MS Access 2003, and I typed in a query in SQL view which was working fine. Now when I open it, it gives me the error "Join expression not supported". Apparently, Access "fixed" it for...
18
by: NickName | last post by:
The following example may further clarify the question, Select fieldA, filedB, fieldC >From tblX Where fieldD = Forms!formName!controlName What I'd like to know is how to determine or get...
4
by: Obi Wan | last post by:
I am running Visual C++ 6 SR5 on a HyperThreaded machine. From time to time the debugger will hangup, forcing a power switch reboot. It does not appear to be related to my application. I...
3
by: serge | last post by:
How do I determine which method I should use if I want to optimize the performance of a database. I took Northwind's database to run my example. My query is I want to retrieve the Employees'...
1
by: kevin | last post by:
I thought that the parse query feature in Query Analyzer simply wrapped your statement in a TRAN and then issued a ROLLBACK statement to prevent making real changes... but i just had a query parse...
9
by: JT | last post by:
I am working on a basic webpage in PHP connecting to a mySQL database, here is my query... //query 1 $query_rs_staff = "SELECT * FROM jtStaff WHERE locationID=".$_GET; $rs_staff =...
1
by: Jimmy V | last post by:
Hey all, I am writing a query builder in C# 2005 and I want to parse the query before I send it to the database. I remember being able to call a Parse or TryParse method on a DMO object or...
1
by: Vinod Sadanandan | last post by:
A Roadmap To Query Tuning ============================ For each SQL statement, there are different approaches that could be used to retrieve the required data. Optimization is the process of...
1
by: shapper | last post by:
Hi, On a form I have an input where tags are inserted in a CSV format. Then on my code I convert the CSV string to a List<Tag>. Tag is an object with two properties: TagID and Name So when I...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.