Re: MDAC 2.8 vs MDAC 2.7
From: Val Mazur (group51a_at_hotmail.com)
Date: 10/30/04
- Next message: Val Mazur: "Re: Performance comparison on Update vs. UpdateBatch - record by record"
- Previous message: Val Mazur: "Re: Access VBA update recordset error"
- In reply to: Jiho Han: "Re: MDAC 2.8 vs MDAC 2.7"
- Next in thread: Michael D. Long: "Re: MDAC 2.8 vs MDAC 2.7"
- Reply: Michael D. Long: "Re: MDAC 2.8 vs MDAC 2.7"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 29 Oct 2004 21:45:23 -0400
Hi,
Actually RecordCount has to do with the provider, because it directly to the
provider if it is able to return actual record count for the specified
cursor. But in a case if provider is not able to return record count, it
will return -1, not 0. In a case of 0 could be two issues: there are no
records in a recordset or it is a bug.
If just changing of the connection string to use OLEDB provider solves this
issue, then it looks like a bug in OLEDB for ODBC provider or in ODBC
driver. But do you get an actual recordset opened in your case?
Initially it was not a good idea to use DSN, because ADO does NOT work with
ODBC drivers directly and has to place OLEDB for ODBC driver in between ADO
and ODBC driver. It just add additional layer with potential bugs in it.
Also you would need to separate declaration and instantiation of the
connection into two separate lines of code. Otherwise it would lead to the
connection and memory leaks. Your code should look like
Dim cn1 as adodb.connection
Set cn1 as new adodb.connection
-- Val Mazur Microsoft MVP "Jiho Han" <jhan@infinityinfo.com> wrote in message news:%23hHjvrdvEHA.716@TK2MSFTNGP10.phx.gbl... > Your problem with RecordCount has nothing to do with OLEDB vs. ODBC nor > MDAC 2.8 vs MDAC 2.7 as the subject suggests. > > Try setting: > > rst.CursorLocation = adUseClient > > before you open the recordset. > >> I have written several vb6 applications with MDAC 2.7 SP1 Refresh. >> This application connects to a SQL Server 2000 SP3a on Windows 20003 >> Server. >> I run this application on a WXP Pro client. >> I have a DSN defined to connect to SQLServer via ODBC >> All works ok with this code: >> Dim cn1 as new adodb.connection >> Dim rst as ADODB.Recordset >> Dim lngNumber as long >> cn1.ConnectionTimeout = 60 >> cn1.CursorLocation = adUseClient >> cn1.Open "DSN=" & sName, sUser, sPwd >> rst.Open "SELECT ID FROM TABLE", cn1, adOpenKeyset, adLockOptimistic >> lngNumber = rst.Recordcount >> >> ' Note that lngNumber = 3567 >> if lngNumber=0 then MsgBox "Error" >> ..... >> If i put the application on Windows 2003 server i get: >> ' The same table with 3567 records return 0 >> if lngNumber=0 then MsgBox "Error" >> and the Box "Error" appears!!!!! >> >> I changed to OleDB and It works but the problem is: >> when all my server will be Win 2003 I will have lots of >> program with problems !!!!!! >> How can i continue in using DSN with ODBC with Windows 2003 server ? >> My customers are not enthusiastic to pay me to >> change all programs ! >> Help me please >> Thank you >
- Next message: Val Mazur: "Re: Performance comparison on Update vs. UpdateBatch - record by record"
- Previous message: Val Mazur: "Re: Access VBA update recordset error"
- In reply to: Jiho Han: "Re: MDAC 2.8 vs MDAC 2.7"
- Next in thread: Michael D. Long: "Re: MDAC 2.8 vs MDAC 2.7"
- Reply: Michael D. Long: "Re: MDAC 2.8 vs MDAC 2.7"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|