[Mono-dev] Odbc-Exception-Error

Jan Waiz hamburg at icomedv.de
Sat Aug 13 06:07:52 EDT 2005


Hi Folks,

 

big Trouble in China! :-)

 

Working with ODBC on a PostgreSQL. 

 

While the ODBC did not support named Parameters and to be save about Signs
like the <’> in Textboxes, i am building my Update-Statements like this:

 

cStmnt = “UPDATE ComanySTD SET” +

              “Name1 = ?,”

              “Name2 = ?”

              “WHERE PKey = ‘” + cPKey + ‘”

 

oCommand.Parameters.Add( “@Name1”, Textbox_Name1.Text.Trim() )

oCommand.Parameters.Add( “@Name2”, Textbox_Name2.Text.Trim() )

oCommand.ExecuteNonQuery()

 

This works fine when starting under Localhost.

 

If running in Mono I get an Error:

 

System.Data.Odbc.OdbcException: [unixODBC]Unrecognized C_parameter type in
copy_statement_with_parameters
 
When changing the Statement to:

 

cStmnt = “UPDATE ComanySTD SET” +

              “Name1 = “ + Textbox_Name1.Text.Trim()  + ,”

              “Name2 = “ + Textbox_Name2.Text.Trim()  + ,”

              “WHERE PKey = ‘” + cPKey + ‘”

 

oCommand.ExecuteNonQuery()

 

it works with Mono – but if there is an <’> in a Textbox it crashes. So I
have to escape special Signs manuel.

 

I found one Entry in Google, where one Developer will have the same Problem
– but there wasn´t any Answers what to do.

 

Someone here who can help me what I have to do?

 

Many Thanks in Advance for any Help !!

 

Regards

Jan Waiz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050813/9eb22376/attachment.html 


More information about the Mono-devel-list mailing list