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_def inst.Workspaces (0)
db = ws.OpenDatabase (DBFileName)
Dim rs As DAO.Recordset
Dim temp As Integer
rs = db.OpenRecordse t("select * from Folder where FolderNo=0")
My converted code in c# is:
DAO._DBEngine dbEng = new DAO.DBEngineCla ss();
DAO.Workspace ws = dbEng.CreateWor kspace("", "admin", "",
DAO.WorkspaceTy peEnum.dbUseJet );
DAO.Database db = ws.OpenDatabase (DBFileName, false, false, "");
DAO.Recordset rs;
rs = db.OpenRecordse t("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.RecordsetTy peEnum, 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#? 0 5384 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: redcard |
last post by:
Hi,
I'm opening a database using the following code:
Set m_dbDatabase = OpenDatabase("", False, False, strOdbc)
Works OK and connects to the database with no problem. If however
while I'm connected the connection is lost (i.e. the server goes down)
and I try to reconnect to the database using the above method I get
success even if the server is still down. But when I try and open a
|
by: Dalan |
last post by:
I can't seem to find a workaround of Query Syntax Error. Actually, the
query performs just fine, except when the last record on a related
subform is deleted, then it generates a Runtime Error 3075 - Syntax
error (missing operator) in query expression 'IDRef = '-- of course,
because there are no more records left with the same IDRef number. And
Set rst = dbs.OpenRecordset(strSQL) is highlighted in the Function
module.
The Function module...
|
by: Dalan |
last post by:
I'm experiencing a Query Syntax Error with an Access 97 Db. Actually,
the query performs as expected when adding any new records or editing
existing ones and even deleting records, EXCEPT when the last record
on any related subform is deleted, then it generates a Runtime Error
3075 - Syntax error (missing operator) in query expression 'IDRef =
'-- of course, because there are no more records left with the same
IDRef number, or none...
|
by: MLH |
last post by:
Suppose I'm in an open database (northwind.mdb). Is there
a shorter form of doing the following after I've dim'd dbsNorthwind
as database...
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
???
Or, should I always use the above syntax in DAO situations where
I just want to move about a recordset in the database updating
|
by: deko |
last post by:
ALTER TABLE DROP CONSTRAINT
;
Is this syntax correct?
The error I'm getting is:
Error Number 3199: Could not find reference.
I tried it without the curly braces, but no luck.
| |
by: Jozef |
last post by:
Hello,
I have a database that I have passworded. When I try to use OpenDatabase
with the Connect parameter filled in, I keep getting "Not a valid password",
even if I use the actual connect string from one of the tables. I have no
other security on the database, just a single password.
This is what I have;
'----Start Code ----
|
by: Feico |
last post by:
With a little help from my friends (that's you) I succeeded to write a
little program.
To access a field in the current record, I simply write its name, for
example:
Value = calculation
Which is, of course, shorthand for
CurrentTable.CurrentRecord.Value = calculation
To access another field, I write
|
by: kids_pro |
last post by:
Hi there,
I am using DAO to read data from MDB file I try the following command to
open database.
DBEngine dbEng = new DBEngineClass();
Workspace ws = dbEng.Workspaces;
db = ws.OpenDatabase(filename, true,false, ";UID=Admin;PWD=" +
Password_DbAdmin);
It is work fine with Window Application. But when I try to call it from
|
by: MLH |
last post by:
Set rstOtherTable = MyDB.OpenRecordset(xxx, dbOpenDynaset)
I have a question regarding syntax of the above OpenRecordset method:
Is it OK for xxx to reference both tables and queries when using
dbOpenDynaset?
And how about these 2 lines together - is the code structure OK?
xxx = "SELECT tblLienHolders.LienHolderID FROM tblLienHolders;"
Set rstOtherTable = MyDB.OpenRecordset(xxx, dbOpenDynaset)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |