473,396 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Accessing Databases

I have a few questions about databases. I would like to load only certain
records into a datagrid. For an example, with a list of customers I want to
only load the customers from California so in my SQL statement I say..

SELECT * FROM customers WHERE state = 'CurState'

I want CurState to be a variable that I can change in my program. Now if I
use the OleDBDataAdapter how do I pass that variable to the database?

also....

Is there a way I can open a connection to the database in my main form and
leave it open until I exit my application? What I am doing is using multiple
datagrids on different forms. Do I need a OleDbDataConnection,
OleDbDataAdapter and a Dataset on each form with a datagrid or can I do this
one time on the main form and have the other forms read the different tables
in the dataset on the main form?

I hope I explained this well enough. Thank you for any help you can give me.

Nov 21 '05 #1
2 1088
Debbie,

SELECT * FROM customers WHERE state = @CurState

Have than a look for the OleDb parameter class to fill that
http://msdn.microsoft.com/library/de...classtopic.asp

Is there a way I can open a connection to the database in my main form and
leave it open until I exit my application? What I am doing is using multiple datagrids on different forms. Do I need a OleDbDataConnection,
OleDbDataAdapter and a Dataset on each form with a datagrid or can I do this one time on the main form and have the other forms read the different tables in the dataset on the main form?

With an access database that is the connection approach a good approach,
with any other database not.

To use one dataset means that you should place the dataset global using a
shared class or whatever. Or give all the time the reference of the dataset
to the forms which is using that when it is instanced.

(By instance by creating an overloaded Sub New)

I hope this helps?

Cor
Nov 21 '05 #2
Thank you Cor for your help. I appreciate it very much.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uU**************@tk2msftngp13.phx.gbl...
Debbie,

SELECT * FROM customers WHERE state = @CurState

Have than a look for the OleDb parameter class to fill that
http://msdn.microsoft.com/library/de...classtopic.asp

Is there a way I can open a connection to the database in my main form and leave it open until I exit my application? What I am doing is using multiple
datagrids on different forms. Do I need a OleDbDataConnection,
OleDbDataAdapter and a Dataset on each form with a datagrid or can I do

this
one time on the main form and have the other forms read the different

tables
in the dataset on the main form?

With an access database that is the connection approach a good approach,
with any other database not.

To use one dataset means that you should place the dataset global using a
shared class or whatever. Or give all the time the reference of the

dataset to the forms which is using that when it is instanced.

(By instance by creating an overloaded Sub New)

I hope this helps?

Cor

Nov 21 '05 #3

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

Similar topics

2
by: Benedictum | last post by:
How do I access data from a database located in a server somewhere with an application running on a local machine?
3
by: Scott Castillo | last post by:
Is it possible to access an SQL Server database from a Javascript client? I know you can transfer variables from middleware to Javascript client, but was wondering if you can directly access...
3
by: TS | last post by:
I am very new to .Net. I have good experience with VB, but I'm still in an early stage of learning .Net plattform. Anyway, I don't know if I'm asking this in the correct newsgroup, but if I'm not,...
1
by: Jim Richards | last post by:
Hello all. I have just built another PC (New PC)and have it connected to my Original PC via a LAN. I have my SQL Server 2000 installed on the Original PC. Both PCs use WinXP Pro OS. I believe I now...
2
by: Douglas Harber | last post by:
If I have DB2 8.1 (FP5, I believe, but not relevant to my question...I hope) installed on my desktop, do I have what I need to connect to a remote DB2 server (also running 8.1 FP5) from my desktop...
10
by: Andrea M. Segovia | last post by:
Hello, I am a newbie to Oracle databases.... We have a visualization front-end tool connected to an Oracle back-end database on a Tru64 UNIX server. We also have clients with MS access...
5
by: David Garamond | last post by:
I am setting up a single PostgreSQL installation to be used by several users. Can I restrict a database user from connecting and creating objects in other databases but his/her own? So far I can...
5
by: samadams_2006 | last post by:
I'm having a problem in accessing a Microsoft Access Database in a VB.NET Web Application. It's so straight forward, I thought I'd walk you through all the details here: 1) I have a .NET Web...
0
landy
by: landy | last post by:
Hi all! Here is my issue - I have a linux box set up as the server for the external webpage for my organization using apache/PHP to write the pages. I also use MySQL on this box for storing...
4
by: Noy B | last post by:
Hi, I have developed a small application that is using a MSAccess DB. the problem is that it was developed on a machine where the application and the DB are both located. now it needs to be...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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,...
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...
0
agi2029
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,...

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.