[Mono-dev] Solved: Re: Problem with parameters using Odbc/ADO.NET/Sybase 9.0.2 ASA
Mads Bondo Dydensborg
mbd at dbc.dk
Wed Jan 3 03:23:07 EST 2007
tirsdag 02 januar 2007 18:35 skrev Daniel Morgan:
> FreeTDS Project is here:
[...]
Thanks for all your pointers.
Unfortunately, Sybase ASE is not an option for me - while ASA is a must.
(Sigh).
It turns out, that it was all my bad. Odbc does not support named parameters,
except when calling stored procedures.
So, changing
insertCommand.CommandText
= "insert into mono_sql_test ( bit_value, int_value ) values ( 1,
@p1 )";
OdbcParameterCollection parameters = insertCommand.Parameters;
parameters.Add ( "@p1", OdbcType.Int );
parameters [ "@p1" ].Value = 42;
to
insertCommand.CommandText
= "insert into mono_sql_test ( bit_value, int_value ) values ( 1, ? )";
OdbcParameterCollection parameters = insertCommand.Parameters;
parameters.Add ( "int_value", OdbcType.Int );
parameters [ "int_value" ].Value = 42;
makes it all work.
So, Mono does work with Sybase ASA 9.0.2 using Odbc, as long as one does not
try to use named parameters.
I have modified a copy of the SqlTest.cs program to test the various calls.
Should I submit this somewhere? (Could perhaps help others along the way).
Regards,
Mads
--
Med venlig hilsen/Regards
Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77 34
More information about the Mono-devel-list
mailing list