Re: Problem updating a record containing a negative Value
From: Val Mazur (group51a_at_hotmail.com)
Date: 09/04/04
- Next message: Steven Bras: "Re: Recordset.Delete and memory leakage"
- Previous message: Val Mazur: "Re: -2147467259 Ado recordset open error Help!"
- In reply to: R. Lowke: "Re: Problem updating a record containing a negative Value"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 3 Sep 2004 21:18:35 -0400
Hi,
If it is the same in ADO or ADO.NET then this is definitely a bug in ODBC
driver. Only suggestion is to try to get an update (if it exists) for this
driver from the vendor. Otherwise you would need to switch to the double
datatype.
--
Val Mazur
Microsoft MVP
"R. Lowke" <rolf_at_work@lycos.de> wrote in message
news:1094138731.3552.0@echo.uk.clara.net...
> Hello,
>
> here are some additional information to my problem:
>
> 1. I tried the same code with ADO.NET and get the same error. This may
> point
> to the ODBC layer causing the problem. I don't know how similar ADO and
> ADO.NET are beneath the surface.
>
> 2. If I change the datatype of the database fields from decimal/numeric to
> double the error does not occur any longer.
>
> I hope someone can help as the values I have to store need the datatype
> decimal or numeric and I also have to use ODBC.
>
> Best regards
> Rolf Lowke
>
> "R. Lowke" <rolf_at_work@lycos.de> schrieb im Newsbeitrag
> news:1094136628.2675.0@echo.uk.clara.net...
>> Thanks for your answer!
>>
>> I already tried it the way you described (I really tried a lot!). It
> should
>> make no difference and really... it makes no difference. I did some IN
>> research on my problem and it seems to be a problem of ADO as I found
>> some
>> articles where other people had the same (or similar) problem with
> different
>> database systems (Oracle and MySQL for example) and different ODBC
> drivers.
>> But I found no solutions, only workarounds that don't are acceptable to
> me.
>> It seems possible to me that ODBC is causing the problem. I can't believe
>> that there's no solution for this. I already tried different versions of
>> MDAC with seems to make also no difference. One posting I found guessed
> that
>> it's a problem of the ADO layer with "finding" the sign position. I
>> really
>> don't know...
>>
>> Best regards (and thanks again)
>> Rolf Lowke
>>
>> "Val Mazur" <group51a@hotmail.com> schrieb im Newsbeitrag
>> news:OI89XEJkEHA.3912@TK2MSFTNGP12.phx.gbl...
>> > Hi,
>> >
>> > Like for me it looks like a bug in a driver, because it does not make
> any
>> > sense and code looks fine. What you could try to do is to use Fields
>> > collection to assign value to the field, bit it should work with your
>> syntax
>> > as well. try to use next kind of code
>> >
>> > rec.Fields("Test2").Value = 42
>> >
>> > --
>> > Val Mazur
>> > Microsoft MVP
>> >
>> >
>> > "R. Lowke" <rolf_at_work@lycos.de> wrote in message
>> > news:1094052733.19090.0@nnrp-t71-02.news.clara.net...
>> > > Hello,
>> > >
>> > > I use an ADO recordset in Visual Basic to connect to an iSeries-table
>> via
>> > > ODBC (Client Access ODBC Driver) and have to update some records.
>> > > This
>> > > works
>> > > fine until I want to update a record that contains a negative value.
>> Then
>> > > I
>> > > get the error message "Row cannot be located for update...". The
>> > > table
>> has
>> > > a
>> > > primary key and i can update if the current record contains no
> negative
>> > > values. It does not matter which numeric field contains the negative
>> > > value.
>> > > I can update even rows with negative values if I use SQL (UPDATE)
>> > > directly,
>> > > but that's no acceptable solution. Here is an example code snippet.
>> Test1
>> > > and Test2 are decimal values, if Test1 contains a negative value the
>> > > mentioned error occurs.
>> > >
>> > > Set cnn = New ADODB.Connection
>> > > With cnn
>> > > .CursorLocation = adUseServer
>> > > .ConnectionString = "DSN=Test"
>> > > Call .Open
>> > > End With
>> > >
>> > > Set rec = New ADODB.Recordset
>> > > With rec
>> > > .ActiveConnection = cnn
>> > > .CursorLocation = adUseServer
>> > > .LockType = adLockOptimistic
>> > > .CursorType = adOpenDynamic
>> > > .Source = "TEST.TEST"
>> > > Call rec.Open(Options:=adCmdTable)
>> > > If .State = adStateOpen Then
>> > > Do While Not rec.EOF
>> > > rec!Test2 = 42
>> > > Call rec.Update
>> > > Call rec.MoveNext
>> > > DoEvents
>> > > Loop
>> > > End If
>> > > End With
>> > >
>> > > Can anyone help me, please!?
>> > >
>> > >
>> >
>> >
>>
>>
>
>
- Next message: Steven Bras: "Re: Recordset.Delete and memory leakage"
- Previous message: Val Mazur: "Re: -2147467259 Ado recordset open error Help!"
- In reply to: R. Lowke: "Re: Problem updating a record containing a negative Value"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|