accessing ADODB Recordset problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello ppl,

I have snippet that works fine udner ADODB with VB6, but something wrong
with it in Vb.NET. Anyone can help?

Recordset1 (ADODB.Recordset) Error: Arguments are of the wrong type, are out
of acceptable range, or are in conflict with one another.
Error Source:

SELECT * FROM Accounts
PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\dbs\db1.mdb;
Recordset1.LockType = 1
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2So i accessed ADODB in this way:Dim rs As New
ADODB.Recordsetrs.ActiveConnection = Connectionrs.CursorLocation =
2rs.CursorType = 0rs.LockType = 1rs.Source = "SELECT * FROM Accounts"
rs.Open()
 
ADO 2.x is dead. ADOX is the new way to go and its a bit different. Have a
look-see at DataAdapters to compare them to your recordsets...

In VB6 you were used to a connected dataset (where data was held within the
recordset object)... not anymore, data is separate from the recordset in a
disconnected form (you don't maintain your connection with the server...)

HTH,
CJ
 
Hi,

I'm not an ADO.NET convert yet! I use ADODB and the speed to me is lightning
fast i,e. populate a grid with 200,000 records in a fraction of a second
from an MS database!!!!

Imports System.Data
Imports System.Data.OleDb
Imports ADODB

Dim Db As New ADODB.Recordset

Db.CursorLocation = CursorLocationEnum.adUseClient
Db.Open("SELECT * FROM Accounts", _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\dbs\db1.mdb;" & _
"user id=;password=;", _
CursorTypeEnum.adOpenStatic,
LockTypeEnum.adLockOptimistic)
do while not db.eof
mygrid= db("my field name").value
db.movenext
loop
db.close
db.activeconnection=nothing

NOTES:
a) If you ever use the LIKE 'a*' query at any time use LIKE 'a%' instead
(note the %, instead of star).
b) In then 'Db.Open("SELECT * FROM Accounts"', simply replace the "SELECT *
FROM Accounts", with a table name for direct table access.


Hope this helps......

Regards,
Merlin
 
hi there, maybe its sounds stupid, but ia have to access to ADODB.Recrdset
throught CreateObject within VB.NET and got my RS working fine, but for some
reason "native" ADODB.NET fires this damn error...

..ev
 
Back
Top