469,582 Members | 2,079 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,582 developers. It's quick & easy.

Syntax for OpenDatabase and OpenRecordset

I need some help in accessing Jet database using DAO.

I have just started to learn c# and am trying to rewrite a program I
have in vb.net to c#. In VB.Net I can do this:

Dim ws As DAO.Workspace
Dim db As DAO.Database
ws = DAODBEngine_definst.Workspaces(0)
db = ws.OpenDatabase(DBFileName)
Dim rs As DAO.Recordset
Dim temp As Integer
rs = db.OpenRecordset("select * from Folder where FolderNo=0")

My converted code in c# is:
DAO._DBEngine dbEng = new DAO.DBEngineClass();
DAO.Workspace ws = dbEng.CreateWorkspace("", "admin", "",
DAO.Database db = ws.OpenDatabase(DBFileName, false, false, "");
DAO.Recordset rs;
rs = db.OpenRecordset("select * from Folder where FolderNo=0", "", ""

The additional parameters in OpenDatabase and OpenRecordset in vb.net
are optional but in c# they are mandatory. I have tried various
combinations, using null, DAO.RecordsetTypeEnum, etc. but I always get
an error at the OpenRecordset line: "Operation is not supported for
this type of object".

I have tried searching the c# Google group plus other groups but have
not found a solution. Does anyone know the proper parameters I should
put in for both OpenDatabase and OpenRecordset in c#?

Nov 17 '05 #1
0 5015

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by redcard | last post: by
12 posts views Thread by Feico | last post: by
4 posts views Thread by kids_pro | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.