Result SQL server(2000) differs between ADO and DAO

T

Toontje

I've made a table in sql server(2000) with the name Test with the
following fields
ID Decimal Precision 18 scale 0 Identity=Yes
W1 Decimal Precision 18 scale 4
W2 Decimal Precision 18 scale 2
W3 Money
W4 Float

When I run next function the results from ADO and DAO are different.
Can someone explain me why?


Public Function TestData()
Dim db As Database
Dim rstADO As ADODB.Recordset
Dim rstDAO As DAO.Recordset

Set db = CurrentDb
Set rstDAO = db.OpenRecordset("SELECT * FROM dbo_Test",
DB_OPEN_DYNASET)
rstDAO.AddNew
rstDAO!W1 = 5 / 4
rstDAO!W2 = 5 / 4
rstDAO!W3 = 5 / 4
rstDAO!W4 = 5 / 4
rstDAO.Update
rstDAO.Close
Set rstDAO = db.OpenRecordset("SELECT * FROM dbo_Test",
DB_OPEN_DYNASET)
Do While Not rstDAO.EOF
Debug.Print "DAO W1: " & rstDAO!W1
Debug.Print "DAO W2: " & rstDAO!W2
Debug.Print "DAO W3: " & rstDAO!W3
Debug.Print "DAO W4: " & rstDAO!W4
rstDAO.Delete
rstDAO.MoveNext
Loop

rstDAO.Close

Set rstADO = New ADODB.Recordset
rstADO.CursorLocation = adUseClient
rstADO.Open "SELECT * FROM dbo_Test", CurrentProject.Connection,
adOpenKeyset, adLockOptimistic
'
rstADO.AddNew
rstADO!W1 = 5 / 4
rstADO!W2 = 5 / 4
rstADO!W3 = 5 / 4
rstADO!W4 = 5 / 4
rstADO.Update
rstADO.Close

rstADO.Open "SELECT * FROM dbo_Test", CurrentProject.Connection,
adOpenKeyset, adLockOptimistic
Do While Not rstADO.EOF
Debug.Print "ADO W1: " & rstADO!W1
Debug.Print "ADO W2: " & rstADO!W2
Debug.Print "ADO W3: " & rstADO!W3
Debug.Print "ADO W4: " & rstADO!W4
rstADO.Delete
rstADO.MoveNext
Loop
End Function

Result of function
DAO W1: 1,25
DAO W2: 1,25
DAO W3: 1,25
DAO W4: 1,25
ADO W1: 12500
ADO W2: 125
ADO W3: 1,25
ADO W4: 1,25
 
T

Todos Menos [MSFT]

dude DAO is obsolete; and it has been for 10 years

it hasn't even been included with office, windows or mdac ever since
2000

spit on anyone using DAO

and for the record; what are the DATATYPES for your table?

and why are you using commas for your decimal places?
 
T

Todos Menos [MSFT]

why would you use decimal for your identity?

use a fucking integer you goddamn newbie


you should focus on SQL Server since learning 2 different dialects of
sql is obviously too much effort for you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top