From: ChristianH on
Hi,

I execute the following OdbcCommand using the NODBC driver:

OdbcCommand command = connection.CreateCommand();

command.CommandText = "SELECT \"Company Name\", \"First Name\",
\"Surname\", \"No_\" FROM \"Contact\" WHERE \"No_\" = ?";

var odbcParam = new OdbcParameter();
odbcParam.ParameterName = "No_";
odbcParam.Value = "CT000001";
command.Parameters.Add(odbcParam);
reader = command.ExecuteReader();

Following combinations work:
->NODBC Driver from NAV 5 to access NAV 5 database.
->NODBC Driver from NAV 5 to Access NAV 2009 database.

Using the NODBC driver from NAV 2009 to access NAV 2009 database I receive
the following OdbcException (command.ExecuteReader() ):
"ERROR [[Lega] [Simba][SimbaEngine ODBC Driver][DRM File Library]cy error
message not found!]"

If I do not use the OdbcParameter and create my SQL command like following
it works with the NAV 2009 ODBC driver to access NAV 2009 database, too:

command.CommandText = "SELECT \"Company Name\", \"First Name\",
\"Surname\", \"No_\" FROM \"Contact\" WHERE \"No_\" = 'CT000001'";
reader = command.ExecuteReader();

Well, what do I have to do to use the NAV 2009 ODBC driver in combination
with ODBCParameter objects?

Thanks
Christian
From: Savatage on
Nodbc is for Native databases - if your on SQl you need to use the ODBC driver
--
(Save->Compile->Enjoy!)
Harry Ruiz
www.CosmeticSolutions.com


"ChristianH" wrote:

> Hi,
>
> I execute the following OdbcCommand using the NODBC driver:
>
> OdbcCommand command = connection.CreateCommand();
>
> command.CommandText = "SELECT \"Company Name\", \"First Name\",
> \"Surname\", \"No_\" FROM \"Contact\" WHERE \"No_\" = ?";
>
> var odbcParam = new OdbcParameter();
> odbcParam.ParameterName = "No_";
> odbcParam.Value = "CT000001";
> command.Parameters.Add(odbcParam);
> reader = command.ExecuteReader();
>
> Following combinations work:
> ->NODBC Driver from NAV 5 to access NAV 5 database.
> ->NODBC Driver from NAV 5 to Access NAV 2009 database.
>
> Using the NODBC driver from NAV 2009 to access NAV 2009 database I receive
> the following OdbcException (command.ExecuteReader() ):
> "ERROR [[Lega] [Simba][SimbaEngine ODBC Driver][DRM File Library]cy error
> message not found!]"
>
> If I do not use the OdbcParameter and create my SQL command like following
> it works with the NAV 2009 ODBC driver to access NAV 2009 database, too:
>
> command.CommandText = "SELECT \"Company Name\", \"First Name\",
> \"Surname\", \"No_\" FROM \"Contact\" WHERE \"No_\" = 'CT000001'";
> reader = command.ExecuteReader();
>
> Well, what do I have to do to use the NAV 2009 ODBC driver in combination
> with ODBCParameter objects?
>
> Thanks
> Christian