Hi All,
I connected to a FireBird 1.5 database this way:
import kinterbasdb
kinterbasdb.init(type_conv=200) # See http://kinterbasdb.sourceforge.net/d...etime_required
Then I try to update the database:
sql = "UPDATE TABLE1 SET DATEFIELD=? where ID = ?"
params=[datetime.date(2007,11,01),2341]
cursor.execute(sql,params)
I get this error:
kinterbasdb.ProgrammingError: (-413, 'isc_dsql_execute: \n conversion
error from string "2007-11-01"')
What is wrong here?
Thanks,
Laszlo 4 1488
On Dec 13, 7:45 pm, Laszlo Nagy <gand...@shopzeus.comwrote:
Hi All,
I connected to a FireBird 1.5 database this way:
import kinterbasdb
kinterbasdb.init(type_conv=200) # Seehttp://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mx...
Then I try to update the database:
sql = "UPDATE TABLE1 SET DATEFIELD=? where ID = ?"
params=[datetime.date(2007,11,01),2341]
cursor.execute(sql,params)
I get this error:
kinterbasdb.ProgrammingError: (-413, 'isc_dsql_execute: \n conversion
error from string "2007-11-01"')
What is wrong here?
Thanks,
Laszlo
Kinterbasdb probably expects the format looking like
month/day/year
rather than
year-month-day
I have an old pythoncard app where there was the same issue
when picking a date using the wx.calendar widget,
Rearranging the format solved the problem.
here is the relevant code snippet ,maybe it gives you the idea:
def on_doCalDate_command(self,event):
# this the way to get a wx.calendar date into a
# format suitable for kinterbasdb
D=[]
MYDATE=str(self.components.Calendar1.date)
SPLITDATE=MYDATE.split('-')
for data in SPLITDATE:
D.append(data)
YR=D[0]
MO=D[1]
DY=D[2]
JOBDATE=MO+"/"+DY+"/"+YR
DB
DarkBlue írta:
On Dec 13, 7:45 pm, Laszlo Nagy <gand...@shopzeus.comwrote:
> Hi All,
I connected to a FireBird 1.5 database this way:
import kinterbasdb kinterbasdb.init(type_conv=200) # Seehttp://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mx...
Then I try to update the database:
sql = "UPDATE TABLE1 SET DATEFIELD=? where ID = ?" params=[datetime.date(2007,11,01),2341] cursor.execute(sql,params)
I get this error:
kinterbasdb.ProgrammingError: (-413, 'isc_dsql_execute: \n conversion error from string "2007-11-01"')
What is wrong here?
Thanks,
Laszlo
Kinterbasdb probably expects the format looking like
month/day/year
rather than
year-month-day
It is not that. The parameter passed to cursor.execute() is a
datetime.datetime instance. It is not a string, so if there is a
formatting problem then it must be inside kinterbasdb. (How would you
control the format if you have no string representation?)
However, I'm 100% sure that others are also using this module and
probably there is something that I should change, just don't know what
it is.
Thanks,
Laszlo
>Kinterbasdb probably expects the format looking like
month/day/year
rather than
year-month-day
All right, I tried the month/day/year version:
print sql
print params
cur.execute(sql,params)
Results in:
Inserting new TTT codes...insert into ttt(
ID,
TTT,
KIHIR
) VALUES (
GEN_ID(G_TTT,1),
?,?)
[210227753, '11/1/2007']
Traceback (most recent call last):
File "c:\Delphi5_Brinkman\Projects\TTTImport\tttupdate. py", line 131,
in <module>
cur.execute(sql,params)
kinterbasdb.ProgrammingError: (-413, 'isc_dsql_execute: \n conversion
error from string "2007-11-01"')
You see, I passed '11/1/2007' but the error says "2007-11-01". So what?
I also tried this:
Inserting new TTT codes...insert into ttt(
ID,
TTT,
KIHIR
) VALUES (
GEN_ID(G_TTT,1),
?, cast( ? as date) )
[210227753, '11/1/2007']
Results in:
Traceback (most recent call last):
File "c:\Delphi5_Brinkman\Projects\TTTImport\tttupdate. py", line 131,
in <modu
le>
cur.execute(sql,params)
kinterbasdb.ProgrammingError: (-804, 'isc_dsql_prepare: \n Dynamic SQL
Error\n
SQL error code = -804\n Data type unknown')
Right now I cannot see any way to specify a date parameter and as time
goes by, it is becoming a biger problem for me. :-(
Please help.
Laszlo
Laszlo Nagy wrote:
>
Hi All,
I connected to a FireBird 1.5 database this way:
import kinterbasdb
kinterbasdb.init(type_conv=200) # See http://kinterbasdb.sourceforge.net/d...etime_required
Then I try to update the database:
sql = "UPDATE TABLE1 SET DATEFIELD=? where ID = ?"
params=[datetime.date(2007,11,01),2341]
cursor.execute(sql,params)
I get this error:
kinterbasdb.ProgrammingError: (-413, 'isc_dsql_execute: \n conversion
error from string "2007-11-01"')
What is wrong here?
Thanks,
Laszlo
Just tested this against my 2.03 firebird db:
import datetime
import kinterbasdb as db
db.init(type_conv=200)
con = db.connect(dsn='myhost:fbtool-dev', user='sysdba', password='pwd')
sql = "update jnp set gebdat = ? where iid = ?"
params = [datetime.date(2007, 11, 01), 1000052]
cur = con.cursor()
cur.execute(sql,params)
con.commit()
It worked.
What version of kinterbasdb are you using?
Uwe This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Max M |
last post by:
# -*- coding: latin-1 -*-
"""
I am currently using the datetime package, but I find that the design is
oddly
asymmetric. I would like to know why. Or perhaps I have misunderstood
how it...
|
by: PK9 |
last post by:
I have a string variable that holds the equivalent of a DateTime value. I
pulled this datetime from the database and I want to strip off the time
portion before displaying to the user.
I am...
|
by: Fritz Switzer |
last post by:
I'd like to have a string assigned the value of a
DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM"
format.
For example:
DateTime.Now.AddMinutes(30) returns "00:30"
...
|
by: Andrew S. Giles |
last post by:
Hello,
I am importing a flat text file, and putting it into a datagrid for display
on a form.
Currently the users have their dates and times seperated. I have two
fields, therefore in the...
|
by: Ante Perkovic |
last post by:
Hi,
How to declare datetime object and set it to my birthday, first or
last day of this month or any other date.
I can't find any examples in VS.NET help!
BTW, what is the difference...
| |
by: I am Sam |
last post by:
I have created this DateTime object and instanced it I think correctly
DateTime myClubNow1=new...
|
by: Cor Ligthert |
last post by:
Hello everybody,
Jay and Herfried are telling me every time when I use CDate that using the
datetime.parseexact is always the best way to do String to datetime
conversions. They don't tell why...
|
by: Phil B |
last post by:
I am having a problem with a datetime from a web services provider
The provider is sending the following SOAP response
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope...
|
by: yasirmturk |
last post by:
Standard Date and Time Functions
The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
|
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,...
|
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...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |