[Mono-dev] Problem with parameters using Odbc/ADO.NET/Sybase 9.0.2 ASA

Daniel Morgan monodanmorg at yahoo.com
Fri Dec 22 10:27:32 EST 2006


I'm only guessing here.

Are you using an ODBC driver for Sybase ASA from
Sybase?

Have you tried using the FreeTDS ODBC driver?

What ODBC manager are you using?  unixODBC, iODBC?

To be honest, I don't think anyone has tested the
Mono's Odbc provider with Sybase ASA.

If there is not a bug for this already in bugzilla,
can you add it please?

http://bugzilla.ximian.com/


--- Mads Bondo Dydensborg <mbd at dbc.dk> wrote:

> Hi there
> 
> I have a program using parameters for inserts using
> Odbc on a Linux platform 
> against a Sybase ASA 9.0.2 server. I have tried to
> make a minimal program to 
> illustrate the problem. It looks like the parameters
> are not substituted?
> 
> The program below fails with:
> 
> $ mono --debug MinTestOdbc.exe
> 
> Unhandled Exception: System.Data.Odbc.OdbcException:
> [Sybase][ODBC Driver]
> [Adaptive Server Anywhere]Column '@p1' not found
>   at System.Data.Odbc.OdbcCommand.ExecSQL
> (System.String sql) [0x000a2] 
> in
>
/home/madsdyd/xIntegra/MONOTRUNK/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs:414
>   at System.Data.Odbc.OdbcCommand.ExecuteNonQuery
> (Boolean freeHandle) 
> [0x0002a] 
> in
>
/home/madsdyd/xIntegra/MONOTRUNK/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs:440
>   at System.Data.Odbc.OdbcCommand.ExecuteNonQuery ()
> [0x00000] 
> in
>
/home/madsdyd/xIntegra/MONOTRUNK/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs:428
>   at MinOdbcTest.Main (System.String[] args)
> [0x0004c] 
> in
>
/home/madsdyd/xIntegra/SybaseTest/Odbc/MinTestOdbc.cs:23
> 
> The Sybase server says :
> 
> ** REQUEST conn: 33    STMT_PREPARE           
> "insert into mono_sql_test ( 
> char_value ) values ( @p1 )"
> ** DONE    conn: 33    STMT_PREPARE           
> Stmt=65539
> ** REQUEST conn: 33    STMT_DESCRIBE_OUTPUT   
> Stmt=-1
> ** DONE    conn: 33    STMT_DESCRIBE_OUTPUT
> ** REQUEST conn: 33    STMT_DESCRIBE_INPUT    
> Stmt=-1
> ** DONE    conn: 33    STMT_DESCRIBE_INPUT
> ** REQUEST conn: 33    STMT_EXECUTE           
> Stmt=65539
> ** ERROR   conn: 33    code: -143 "Column '@p1' not
> found"
> 
> This is mono/mcs from current svn.
> 
> The program is this:
> 
> using System;
> using System.Data;
> using System.Data.Odbc;
> using System.Text;
> 
> class MinOdbcTest {
>   static void Main(string[] args) {
> 
>     OdbcConnection cnc = new OdbcConnection 
> ( "DSN=SybaseASA;UID=DBA;PWD=SQL" );
>     cnc.Open();
> 
>     OdbcCommand insertCommand = cnc.CreateCommand();
>     insertCommand.CommandText 
>       = "insert into mono_sql_test ( char_value )
> values ( @p1 )";
>   
>     OdbcParameterCollection parameters =
> insertCommand.Parameters;
>   
>     parameters.Add ( "@p1", OdbcType.Char );
>     parameters [ "@p1" ].Value = "This is a char";
>     
>     insertCommand.ExecuteNonQuery ();
> 
>     cnc.Close();
>   }
> }
>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Mono-devel-list mailing list