PC Review


Reply
Thread Tools Rate Thread

Accessing Databases

 
 
Debbie Carter
Guest
Posts: n/a
 
      31st Aug 2004
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.



 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      31st Aug 2004
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


 
Reply With Quote
 
Debbie Carter
Guest
Posts: n/a
 
      31st Aug 2004
Thank you Cor for your help. I appreciate it very much.



"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing and quering databases itman Microsoft Access Getting Started 5 28th Aug 2009 05:15 PM
Accessing other databases in access techie jamal Microsoft Access Database Table Design 2 11th Mar 2008 07:02 PM
Accessing Multiple Databases =?Utf-8?B?VHkgQXJjaGVy?= Microsoft Access 4 27th Sep 2007 10:34 PM
Accessing multiple Access databases =?Utf-8?B?QnJ1Y2VBSVM=?= Microsoft Access VBA Modules 2 2nd Jul 2004 03:26 AM
Accessing different databases from a database already open hall ted Microsoft Access 9 13th Feb 2004 12:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:18 PM.