
VB5/ADO/SQL 6.5 currency field update fails?
I have set up a test table in SQL 6.5 consisting of an integer field
(keyField) and a money field (currencyField). When I try to update the
currency field I get this error: [ODBC Server Driver] Invalid character
value for cast specification. The test code looks like this:
Private Sub cmdWrite_Click()
Dim rstTest As New ADODB.Recordset
Dim strSQL As String
Dim strWhere As String
strSQL = "SELECT keyField, currencyField FROM dbo.tblTest WHERE "
If flgNew Then
strWhere = "0 =1"
Else
strWhere = "keyField = " & lngKey
End If
rstTest.Open strSQL & strWhere, mcnSetDb, adOpenForwardOnly,
adLockOptimistic, adCmdText
With rstTest
If flgNew Then .AddNew
.Fields("keyField") = lngKey
.Fields("currencyField") = curCurrencyField
.Update
.Close
End With
End Sub
If I use some other field type for the second field, everything works fine
with the same code.
Any ideas????? Thanks.
Barry Fitzgerald