Sebas, Problem is, that the ODBC-Classes did not support named Parameters. When doing as you describe, I got a Runtime-Error
Syntax-Error at Sign,,, Did you use the ODBC-Classes ? Regards Jan Waiz -----Ursprüngliche Nachricht----- Von: Sébastien Robitaille [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 17. August 2005 15:14 An: [EMAIL PROTECTED] Cc: mono-devel-list@lists.ximian.com Betreff: RE: [Mono-dev] URGENT: Odbc-Exception-Error Hi, maybe you should try something like this instead: cStmnt = "UPDATE ComanySTD SET [EMAIL PROTECTED], [EMAIL PROTECTED] WHERE [EMAIL PROTECTED]"; oCommand.Parameters.Add("@Name1", Textbox_Name1.Text.Trim() ) oCommand.Parameters.Add("@Name2", Textbox_Name2.Text.Trim() ) oCommand.Parameters.Add("@PKey", cPKey); oCommand.ExecuteNonQuery() Sébas -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Daniel Morgan Sent: August 17, 2005 8:13 AM To: [EMAIL PROTECTED] Cc: mono-devel-list@lists.ximian.com Subject: Re: [Mono-dev] URGENT: Odbc-Exception-Error Read up on MSDN documentation on System.Data.Odbc.OdbcCommand property CommandText The Odbc provider uses question mark placeholders. It does not support named parameters. You have to use a SQL statement like: SELECT * FROM SOME_TABLE WHERE SOME_ID = ? In your parameters, it is positional, not named. I noticed in your code your are mis-matching. In your SQL statement, you have placeholders, but your creation of the parameters you are using named parameters with an @ symbol. You can not do this. cStmnt = UPDATE ComanySTD SET + Name1 = ?, Name2 = ? WHERE PKey = + cPKey + " oCommand.Parameters.Add(new OdbcParameter).Value = Textbox_Name1.Text.Trim(); oCommand.Parameters.Add(new OdbcParameter).Value = Textbox_Name2.Text.Trim(); oCommand.ExecuteNonQuery(); If Odbc does not work for you, try Npgsql instead to connect to PostgreSQL. Jan Waiz wrote: > HI All, > > view Days ago i postet Porblems with ODBC and Postgre. > > One Answer was testet without solving the Problem so I send it to > bugzilla without any Answer up to know. > > Now I am running in Timeproblems for the Project because I cant > finish important Parts of the Application and the Deadline will come! > So I am coming in Trouble if I did not found a Solution. Be so kind > and let me know: > > How did YOU work via ODBC with a SQL-Database meaning: How did you > build Insert- or Updatestatements? And how did you solve the Problem > with escaping Signs like <> or german Signs like äöü ? Or did you > work with an other SQL-Database in the descriped way without any > Problems (*s*) ? > > In short I am doing it like this: > > cStmnt = UPDATE ComanySTD SET + > > Name1 = ?, > > Name2 = ? > > WHERE PKey = + cPKey + > > oCommand.Parameters.Add( [EMAIL PROTECTED], Textbox_Name1.Text.Trim() ) > > oCommand.Parameters.Add( [EMAIL PROTECTED], Textbox_Name2.Text.Trim() ) > > oCommand.ExecuteNonQuery() > > wich is working fine running under Localhost but makes an Error > running under Mono: > >System.Data.Odbc.OdbcException: [unixODBC]Unrecognized C_parameter type in copy_statement_with_parameters > > > > When changing to: > > cStmnt = UPDATE ComanySTD SET + > > Name1 = + Textbox_Name1.Text.Trim() + , > > Name2 = + Textbox_Name2.Text.Trim() + , > > WHERE PKey = + cPKey + > > It works. But without excaping! And Signs like äöü will shown as > Crashed-Signs in a Textbox when showing a Record. > > I am playing around with different Ways using Parameter like: > > oCommand.Parameters.Add( [EMAIL PROTECTED], OdbcType.varchar, 36 ).Value = > Textbox_Name1.Text.Trim() > > but everytime the same Runtimeerror. > > So now I am at the end of my Nerves and my Knowledge. Hope, there is > anyone outside there, who can tell me, how he is using ODBC-Parameter > > Many Thanks for ANY Help !!! > > Jan Waiz > >------------------------------------------------------------------------ > >_______________________________________________ >Mono-devel-list mailing list >Mono-devel-list@lists.ximian.com >http://lists.ximian.com/mailman/listinfo/mono-devel-list > > _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list