473,473 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to access the queries made and stored in MS Access thru C# Code?

hi,

Does anybody know how to access the queries made and stored in MS Access
thru C# Code.

thanks,
bjorn
Nov 13 '05 #1
1 1580
Yes. You will need to use classes in namespaces

System.Data
System.Data.OleDb

A quick example of a function that returns a dataset might be
(unchecked)

--------------------------------
using System.Data;
using System.Data.OleDb;

public class MyClass
{
string strConnect = "enter your OLEDB connection string here";

public static DataSet ExecuteDataset(string strSQL)
{
try
{
//create a command and prepare it for execution
OleDbConnection objConn = new OleDbConnection(strConnect);
OleDbDataAdapter objAdapt = new OleDbDataAdapter(strSQL, objConn);

//Fill the dataset
DataSet DS = new DataSet();
objAdapt.Fill(DS, "DataTable");
return DS;
}

catch (Exception ex)
{
//return nothing if an error has occurred
return null;
}

}
}
---------------------------------
to use the function, you might do the following:

DataSet objDS = myproject.MyClass.ExecuteDataset("SELECT * FROM
qryMySavedQuery");
---------------------------------

There's a lot to learn in.NET so I'm not going to try to show you
everything here. If you're not familiar with .NET, you will probably
want to buy yourself a book and learn about it, especially the data
access portion (System.Data, otherwise known as ADO.NET) of the
framework.

Bill E.
Hollywood, FL

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: mmm, Pie | last post by:
I never ever thought about this, but recently I made a query in access so I can make a customer mailing list based on relational information and it was so easy to make the query and join tables and...
9
by: Daven Thrice | last post by:
If I have a fairly big Access MDB, that is relational, and has, say, 100 objects (forms, reports, modules, etc.), what is the path to get this database "online". Is there a way to put the tables...
4
by: BerkshireGuy | last post by:
Our IT department wants to place our Access 2000 tables on an SQL server due to the fact the tables are quite large. With that said, can we still use the Access queries or do we have to do...
11
by: DFS | last post by:
Architecture: Access 2003 client, Oracle 9i repository, no Access security in place, ODBC linked tables. 100 or so users, in 3 or 4 groups (Oracle roles actually): Admins, Updaters and ReadOnly....
1
by: b. hotting | last post by:
hi, Does anybody know how to access the queries made and stored in MS Access thru C# Code. thanks, bjorn
10
by: Hank | last post by:
We have just recently migrated the data from our Access 2000 backend to Postgres. All forms and reports seem to run correctly but, in many cases, very slowly. We do not want to switch over until...
2
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with...
5
by: jonceramic | last post by:
Hi All, I started developing in Access, and people took notice and so we're starting to migrate into our corporate's bigger Oracle system. I'll still be using my developed Access front ends,...
1
by: zadkiel | last post by:
Hi all! Recently i need to urgently perform an audit trail for my newly built system. I have gone thru many threads about using trackchanges() function at beforeupdate to record the changes made in...
0
marktang
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,...
0
Oralloy
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,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.