This question is locked. New answers and comments are not allowed.
Brian Goldman
Top achievements
Rank 2
Brian Goldman
asked on 10 Dec 2008, 11:56 PM
This may have been mentioned before, I couldn't find it. When using a text column I get an error
SqlCommand.Prepare method requires all variable length parameters to have an explicitly set non-zero Size.
Any workaround?
Thanks,
Brian
SqlCommand.Prepare method requires all variable length parameters to have an explicitly set non-zero Size.
Any workaround?
Thanks,
Brian
5 Answers, 1 is accepted
0
Accepted
Hello Brian Goldman,
We need the length definiton of 0 in the mapping file for Text columns. You can do that in the mapping dialog or directly in the mapping file like this:
Best wishes,
Jan Blessenohl
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
We need the length definiton of 0 in the mapping file for Text columns. You can do that in the mapping dialog or directly in the mapping file like this:
<class name="Person"> |
<field name="name"> |
<extension key="db-column"> |
<extension key="db-sql-type" value="TEXT" /> |
<extension key="db-length" value="0" /> |
</extension> |
</field> |
</class> |
Best wishes,
Jan Blessenohl
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jouie
Top achievements
Rank 1
answered on 07 Apr 2009, 03:18 AM
Hi Jan,
I used your solution above but I got this error:
"Update failed: Telerik.OpenAccess.RT.sql.SQLException: The data types text and varchar are incompatible in the equal to operator.\r\nStatement(s) could not be prepared.\r\n at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()\r\n at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()\r\n at OpenAccessRuntime.Relational.RelationalStorageManager.generateUpdates(OID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, Boolean haveNewObjects, CharBuf s)\nRow: GenericOID@7 Template template_id=6\nUPDATE [template] SET [content_html]=? WHERE [template_id] = ? AND [content_html]=?\n(set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: The data types text and varchar are incompatible in the equal to operator.\r\nStatement(s) could not be prepared.\r\n at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()\r\n at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()\r\n at OpenAccessRuntime.Relational.RelationalStorageManager.generateUpdates(OID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, Boolean haveNewObjects, CharBuf s)"
Below is the mapping sample:
Is there a way to set just the primary key as the only parameter in the where clause of generated statement? Or any workaround?
Thanks,
Jouie
I used your solution above but I got this error:
"Update failed: Telerik.OpenAccess.RT.sql.SQLException: The data types text and varchar are incompatible in the equal to operator.\r\nStatement(s) could not be prepared.\r\n at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()\r\n at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()\r\n at OpenAccessRuntime.Relational.RelationalStorageManager.generateUpdates(OID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, Boolean haveNewObjects, CharBuf s)\nRow: GenericOID@7 Template template_id=6\nUPDATE [template] SET [content_html]=? WHERE [template_id] = ? AND [content_html]=?\n(set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: The data types text and varchar are incompatible in the equal to operator.\r\nStatement(s) could not be prepared.\r\n at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()\r\n at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()\r\n at OpenAccessRuntime.Relational.RelationalStorageManager.generateUpdates(OID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, Boolean haveNewObjects, CharBuf s)"
Below is the mapping sample:
<class name="Template"> |
<extension key="db-do-not-create-table" value="true" /> |
<extension key="db-table-name" value="template" /> |
<field name="templateId"> |
<extension key="db-column"> |
<extension key="db-type" value="INTEGER" /> |
<extension key="db-column-name" value="template_id" /> |
</extension> |
</field> |
<field name="contentHtml"> |
<extension key="db-column"> |
<extension key="db-sql-type" value="TEXT" /> |
<extension key="db-length" value="0" /> |
</extension> |
</field> |
<field name="contentText"> |
<extension key="db-column"> |
<extension key="db-sql-type" value="TEXT" /> |
<extension key="db-length" value="0" /> |
</extension> |
</field> |
</class> |
Is there a way to set just the primary key as the only parameter in the where clause of generated statement? Or any workaround?
Thanks,
Jouie
0
Hi Jouie,
please add an additional
<extension key="db-type" value="LONGVARCHAR" />
to the respective column mapping (also doable via the forward mapping dialog). This extension avoids that the column is handled as an updatable column. Please note, that also in your case the db-optimistic-locking with 'changed' seems not to work well as no other columns are then checked; maybe you should switch to a version field for concurrency control.
Kind regards,
Thomas
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
please add an additional
<extension key="db-type" value="LONGVARCHAR" />
to the respective column mapping (also doable via the forward mapping dialog). This extension avoids that the column is handled as an updatable column. Please note, that also in your case the db-optimistic-locking with 'changed' seems not to work well as no other columns are then checked; maybe you should switch to a version field for concurrency control.
Kind regards,
Thomas
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Thomas
Top achievements
Rank 1
answered on 22 Apr 2009, 06:33 AM
Hello.
I have exactly the same problem. But all extensions won't help.
This is was an example column looks:
My current workaround is that I store null into the properties which seems to work. How do I solve this so that I can store empty strings ( like string.Empty ) into the db?
Regards,
Thomas
I have exactly the same problem. But all extensions won't help.
This is was an example column looks:
<field name="vgsEmaUeberwachungsbereich"> | |
<extension key="db-column"> | |
<extension key="db-type" value="LONGVARCHAR" /> | |
<extension key="db-column-name" value="vgs_ema_ueberwachungsbereich" /> | |
<extension key="db-sql-type" value="TEXT" /> | |
<extension key="db-length" value="0" /> | |
</extension> | |
</field> |
My current workaround is that I store null into the properties which seems to work. How do I solve this so that I can store empty strings ( like string.Empty ) into the db?
Regards,
Thomas
0
Hello Thomas,
I've just identified the problem (MSSQL does not allow 0 as a valid size in the ADO parameter) and the next build will contain the patch.
Workaround: Specify a large (10000000) number as the db-length. This will not alter your table.
Sincerely yours,
Thomas
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I've just identified the problem (MSSQL does not allow 0 as a valid size in the ADO parameter) and the next build will contain the patch.
Workaround: Specify a large (10000000) number as the db-length. This will not alter your table.
Sincerely yours,
Thomas
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.