Bobspadger / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Insert into Nullable DateTimeField failed #183

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a model field with models.DateTimeField(null = True, blank = True)
2. Pass None as a value for this field
3. it failed on .save() (see the traceback below)

What is the expected output? What do you see instead?
NULL value should be inserted.

What version of the product are you using? On what operating system?

Django: 1.3.0 final
Python: Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit 
(Intel)] on win32
Windows: Windows 7 Professional SP1
SQL Server: SQL Server 2005
pyodbc: pyodbc-2.1.7-py2.6
django-pyodbc: pyodbc-2.1.8.win32-py2.6.exe

Please provide any additional information below.

Traceback (most recent call last):
  File "C:\Test\test_insert.py", line 65, in <module>
    lead.save()
  File "C:\Python26\lib\site-packages\django\db\models\base.py", line 460, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "C:\Python26\lib\site-packages\django\db\models\base.py", line 553, in save_base
    result = manager._insert(values, return_id=update_pk, using=using)
  File "C:\Python26\lib\site-packages\django\db\models\manager.py", line 195, in _insert
    return insert_query(self.model, values, **kwargs)
  File "C:\Python26\lib\site-packages\django\db\models\query.py", line 1436, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "C:\Python26\lib\site-packages\django\db\models\sql\compiler.py", line 791, in execute_sql
    cursor = super(SQLInsertCompiler, self).execute_sql(None)
  File "C:\Python26\lib\site-packages\django\db\models\sql\compiler.py", line 735, in execute_sql
    cursor.execute(sql, params)
  File "C:\Python26\lib\site-packages\django\db\backends\util.py", line 34, in execute
    return self.cursor.execute(sql, params)
  File "C:\Python26\lib\site-packages\sql_server\pyodbc\base.py", line 318, in execute
    return self.cursor.execute(sql, params)
pyodbc.Error: ('07009', '[07009] [Microsoft][SQL Native Client]Invalid 
Descriptor Index (0) (SQLDescribeParam); [07009]
[Microsoft][SQL Native Client]Invalid parameter number (0)')

Original issue reported on code.google.com by nbma...@gmail.com on 20 Jun 2011 at 2:12

GoogleCodeExporter commented 9 years ago
Sorry, wrong project. I have re-posted it in django-pyodbc.

Original comment by nbma...@gmail.com on 20 Jun 2011 at 2:37

GoogleCodeExporter commented 9 years ago

Original comment by mkleehammer on 9 Jul 2011 at 1:14