Thanks, that worked great.
--- Gilles Bayon <[EMAIL PROTECTED]> wrote:
> Try to specify the dbType inline or via parameterMap
>
>
#propertyName,type=string,dbype=Varchar,direction=Input,nullValue=N/A,handler=string#
>
> <parameter property="RowVersion" dbType="Binary" />
> Rem: Any time the contents of a row changes, SQL
> Server will modify the
> value of the timestamp column
>
> On 8/3/05, Shawn Smiley <[EMAIL PROTECTED]>
> wrote:
> >
> > Thanks Gilles,
> >
> > I already have the property setup as you describe.
> My
> > problem is in feeding the version back into the
> SQL
> > Statement during a delete or update.
> >
> > This is the statement I have in my Map file:
> > <delete id="DeleteVisit" parameterClass="Visit">
> > DELETE FROM Visits
> > WHERE VisitID=#VisitId# AND Version=#RowVersion#
> > </delete>
> >
> > When this is run, I get the following error:
> > "Disallowed implicit conversion from data type
> > nvarchar to data type timestamp, table
> 'dbo.Visits',
> > column 'Version'. Use the CONVERT function to run
> > this query."
> >
> > If I wrap the #RowVersion# in a CONVERT(TIMESTAMP,
> > #RowVersion#) statement nothing gets deleted which
> > seems to indicate to me that the Timestamp isn't
> the
> > same when passed back for the delete.
> >
> > I'm developing on a local SQL Server database with
> no
> > other activity going on that could be affecting
> the
> > record and the delete works perfectly if I take
> out
> > the version check.
> >
> > Thanks again,
> > Shawn.
> >
> >
> > --- Gilles Bayon <[EMAIL PROTECTED]> wrote:
> >
> > > A SQL server timestamp is a 8 Byte array so you
> can
> > > retrieve it with a
> > > property like this
> > >
> > > public Byte[] Version
> > > {
> > > get { return _version; }
> > > set { _version = value; }
> > > }
> > >
> > >
> > > On 8/3/05, Shawn Smiley <[EMAIL PROTECTED]>
> > > wrote:
> > > >
> > > > How do I use a SQL Server 2000
> > > Timestamp/Rowversion
> > > > field with iBatis to provide concurency checks
> > > during
> > > > updates/deletes?
> > > >
> > > > I've added the field to all of my table, added
> a
> > > > byte[] property for the Rowversion to all of
> my C#
> > > > Objects, and finally have updated the
> statement
> > > and
> > > > map xml entries to include the field.
> > > >
> > > > I get one of two errors depending on how I
> > > structure
> > > > my statement:
> > > >
> > > > With: DELETE FROM Tablename WHERE ID=#ID# AND
> > > > Version=#Version#
> > > >
> > > > I get a cannot convert from nvarchar to
> timestamp
> > > > error.
> > > >
> > > > If I change the SQL to: DELETE FROM Tablename
> > > WHERE
> > > > ID=#ID# and Version=CONVERT(TIMESTAMP,
> #Version)
> > > >
> > > > I don't get an error, but the record is not
> > > deleted.
> > > >
> > > >
> > > > Any suggestions on what I'm missing here?
> > > >
> > > > Thanks,
> > > > Shawn.
> > > >
> > > >
> __________________________________________________
> > > > Do You Yahoo!?
> > > > Tired of spam? Yahoo! Mail has the best spam
> > > protection around
> > > > http://mail.yahoo.com
> > > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
>
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail