I'm doing an insert into a SQL Server table using a qmark SQL statement. I'm getting the following error because some of the number fields are NULL.
The error I'm getting is -
File "c:\python27\lib\site-packages\adodbapi\adodbapi.py", line 875, in execute
self._execute_command()
File "c:\python27\lib\site-packages\adodbapi\adodbapi.py", line 690, in _execute_command
self._raiseCursorError(klass, _message)
File "c:\python27\lib\site-packages\adodbapi\adodbapi.py", line 563, in _raiseCursorError
eh(self.connection, self, errorclass, errorvalue)
File "c:\python27\lib\site-packages\adodbapi\apibase.py", line 54, in standardErrorHandler
raise errorclass(errorvalue)
adodbapi.apibase.DatabaseError: (-2147352567, 'Exception occurred.', (0, u'Microsoft SQL Server Native Client 11.0', u'Error converting data type nvarchar to nu
meric.', None, 0, -2147217913), None)
Then for the fields in question it outputs
Name: p9, Dir.: Input, Type: adInteger, Size: 0, Value: "None", Precision: 0, NumericScale: 0
Name: p10, Dir.: Input, Type: adInteger, Size: 0, Value: "None", Precision: 0, NumericScale: 0
I've traced things through a bit and the parameter correctly hits the logic
elif adotype == adc.adEmpty: # ADO will not let you specify a null column
in _configure_parameter in adodbapi with value set to None, adotype as 0 and settings_known as None.
I'm not sure at what point it then gets converted to "None" instead.
The fields in the SQL table are the Numeric type.
Oops - my mistake. I've just noticed that the problem was with another field which had text in it.
Can someone close this please.
Sorry you were having trouble. Is there a way that the error message could have been improved to lead you the actual problem? Sonding an incorrect error message is a bug.