Jet Yes/No fields in Access are not an OleDb database type but specific to Access so iBATIS.NET doesn't support it. iBATIS.NET only support (most of them) DbType define in OleDbType enumeration.
-Gilles On Mon, 24 Jan 2005 10:56:02 -0800 (PST), Ron Grabowski <[EMAIL PROTECTED]> wrote: > I'm using IBatis with the OleDb provider to access an Access database. > I was getting the following exception when I tried this simple update > statement using a parameter class that contained a System.Boolean > property named Published: > > UPDATE Address SET Published = #Published# WHERE AddressID = 1 > > Access calls such a field a Yes/No column. Running that code resulted > in this exception: > > OledbException 0x80040e07 Data type mismatch criteria expression > > It turns out that I needed to specify the type of the Published column > (see the chart on page 28 of the pdf): > > UPDATE Address SET Published = #Published:Boolean# WHERE AddressID = 1 > > While that wasn't terribly difficult to figure out, I was expecting > iBatis to figure out the column type for me. It seems to handle other > common types correctly: dates, varchars, etc. > > If a ever change the provider to SQL Server (very likely) or Oracle > (less likely), I'm afraid that I'll need to specify a different type > based on that provider (see page 28 of the pdf manual): > > SQL Server (SqlDbType.Bit): > UPDATE Address SET Published = #Published:Bit# WHERE AddressID = 1 > > Oracle (OracleType.Byte) > UPDATE Address SET Published = #Published:Byte# WHERE AddressID = 1 > > For simple statements like that, I'd like to avoid using parameter maps > and in-line parmaeters (colon notation) as much as possible to > encourage sql map re-use across providers. > > Is expecting my original statement: > > UPDATE Address SET Published = #Published# WHERE AddressID = 1 > > to work with the OleDb provider just wishful thinking? > > - Ron >