[Mono-list] ODBC.NET Provider on Windows

Brian Ritchie brianlritchie@hotmail.com
Fri, 11 Oct 2002 10:27:42 -0400


Here's the fix...

In libodbc.cs, the OdbcReturn enum needs to be a short.

internal enum OdbcReturn : short {
Error = -1,

InvalidHandle = -2,

StillExecuting = 2,

NeedData = 99,

Success = 0,

SuccessWithInfo = 1

}

Let me know if this works for you,

Brian

----- Original Message -----
From: "Brian Ritchie" <brianlritchie@hotmail.com>
To: "Daniel Morgan" <danmorg@sc.rr.com>; "Mono-List" <mono-list@ximian.com>
Sent: Friday, October 11, 2002 9:17 AM
Subject: Re: [Mono-list] ODBC.NET Provider on Windows


> Guys,
>
> I'm able to duplicate the problem.  The very first call into odbc32 is
> failing.  It is a pretty basic call...it only allocates the first handle.
> So, it appears to be some sort of interop problem with the dll.  I'm still
> checking into it.  Let me know if you have any thoughts.
>
> Brian
>
> ----- Original Message -----
> From: "Daniel Morgan" <danmorg@sc.rr.com>
> To: "Mono-List" <mono-list@ximian.com>
> Sent: Friday, October 11, 2002 3:49 AM
> Subject: [Mono-list] ODBC.NET Provider on Windows
>
>
> > Rodrigo and Brian
> >
> > I have tried to get the Odbc.net provider to use Microsoft Window's
native
> > ODBC library which is odbc32.dll by changing the DllImport from
"libodbc"
> to
> > "odbc32".  The library apparently loads,
> > but I don't know what the errors are for.
> >
> > Any ideas?
> >
> > This is the results I got:
> >
> > DanielMorgan@DANPC ~/mono/mcs/class/System.Data/Test
> > $ mono OdbcTest.exe
> > ERROR: SQLAllocHandle: <528285696>
> > ERROR: SQLSetEnvAttr: <528285696>
> > ODBCInit Complete.
> > ERROR: SQLAllocHandle(hdbc): <528285696>
> > ERROR: SQLConnect: <65535>
> > ERROR: SQLAlloc(Prepare): <528351231>
> > ERROR: SQLPrepare: <528351230>
> > ERROR: SQLExecute: <528351230>
> > ERROR: SQLCancel: <528351230>
> >
> > Unhandled Exception: System.NotImplementedException: The requested
feature
> > is no
> > t yet implemented
> > in <0x0002b> 00 System.Data.Odbc.OdbcCommand:Dispose (bool)
> > in <0x00015> 00 System.ComponentModel.Component:Dispose ()
> > in <0x00174> 00 Test.OdbcTest.OdbcTest:Main (string[])
> >
> > I have a ODBC.net test named OdbcTest.cs that works on Windows XP
> > using .NET 1.1 Beta, but not Mono:
> >
> > using System;
> > using System.Data;
> > using System.Data.Odbc;
> >
> > namespace Test.OdbcTest
> > {
> > class OdbcTest
> > {
> > [STAThread]
> > static void Main(string[] args)
> > {
> > OdbcConnection dbcon = new OdbcConnection();
> > // connection string to a Microsoft SQL Server 2000 database
> > dbcon.ConnectionString =
> > "DRIVER={SQL Server};" +
> > "SERVER=(local);" +
> > "Trusted_connection=true;" +
> > "DATABASE=pubs;";
> >
> > dbcon.Open();
> >
> > OdbcCommand dbcmd = new OdbcCommand();
> > dbcmd.Connection = dbcon;
> > dbcmd.CommandType = CommandType.Text;
> > dbcmd.CommandText = "SELECT lname FROM employee";
> >
> > OdbcDataReader reader;
> > reader = (OdbcDataReader) dbcmd.ExecuteReader();
> >
> > while(reader.Read()) {
> > Console.WriteLine("Last Name: " + reader[0].ToString());
> > }
> > reader.Close();
> > dbcmd.Dispose();
> > dbcon.Close();
> > }
> > }
> > }
> >
> >
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>