473,722 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

best way to open tables?

Hi Everyone,

I have been writing xBase applications for many years but I am new to
VB/SQL for larger applications.

In xBase, I would start the main program (form) by opening up all the
datafiles (dbf) and indexes (cdx) that I would need to reference
throughout the application. I would also keep these files open
throughout the application.

I know how to declare and use SqlConnection, SqlDataAdapter, DataSet to
get a simple grid on a form. My problem occurs when I want to have many
different tables opened (many filtered) through out the application.

My questions:
- What is the equivalent way to do this in VB? (open several tables at
the start)

- Where and how do I declare the connections (SqlCon, DataAdapters,
Datset)? At the top of the main form? In a code module? As public
variable?

- Is it best to filter and sort tables via DataViews?

Thanks

Richard


Nov 21 '05 #1
5 1251
Richard,

The best way is to begin.

You can for that choose if you go the way of the designer method or do all
in code.
When you choose the desigener route, than you will probably see that after a
while you go to the coded way.

In both situations have a look first what is a dataset, as I try to describe
it beneath as simple that I can do.

A dataset is nothing more than an object that keeps together one or more
datatables.
Those datatables have rows(objects) and those have items(objects). The items
are described in the datatable columns. A dataset can as well hold
datarelations.

Therefore what method you take, keep an eye that you don't create all kind
of datasets. One is normally for your application enough (It can be that you
want to use it for by instance webservice or whatever. Than you will see
that you will create more).

You can however create as much datatables as you wish in a dataset. Every
datatable, or combined datatable, needs his own SQL string. You can use one
datadapter from which you change everytime the SQLstring. Probably is more
easy to create for every datatable that you use its own dataadatapter.

And comming back on your main question. Because it is disconnected. Keep as
less data in your tables as you are possible to do, it is better to do more
times updates. And therefore don't start to load all your tables at your
client. When you work with Net try than to work as it was for a PDA or that
you had to sent the data over the Internet.

I hope this gives some idea's?

Cor
Nov 21 '05 #2
Are you going to be using dbf tables ?
if so: we have common ground, in short this is a waste of time in
straight vb using oledb or similar, odbc is very slow on large dbf
tables (eg. > 100Mb)

the best article i've read on this was at http://www.west-wind.com/

post reading this, I've constructed my own dbf wrapper and am happily
still access data using very traditional seeks, open, closes

Richard Fagen wrote:
Hi Everyone,

I have been writing xBase applications for many years but I am new to
VB/SQL for larger applications.

In xBase, I would start the main program (form) by opening up all the
datafiles (dbf) and indexes (cdx) that I would need to reference
throughout the application. I would also keep these files open
throughout the application.

I know how to declare and use SqlConnection, SqlDataAdapter, DataSet to
get a simple grid on a form. My problem occurs when I want to have many
different tables opened (many filtered) through out the application.

My questions:
- What is the equivalent way to do this in VB? (open several tables at
the start)

- Where and how do I declare the connections (SqlCon, DataAdapters,
Datset)? At the top of the main form? In a code module? As public
variable?

- Is it best to filter and sort tables via DataViews?

Thanks

Richard


Nov 21 '05 #3
the article a west wind was;
http://www.west-wind.com/presentatio...ASPObjects.htm

also applies to vb

dave bray wrote:
Are you going to be using dbf tables ?
if so: we have common ground, in short this is a waste of time in
straight vb using oledb or similar, odbc is very slow on large dbf
tables (eg. > 100Mb)

the best article i've read on this was at http://www.west-wind.com/

post reading this, I've constructed my own dbf wrapper and am happily
still access data using very traditional seeks, open, closes

Richard Fagen wrote:
Hi Everyone,

I have been writing xBase applications for many years but I am new to
VB/SQL for larger applications.

In xBase, I would start the main program (form) by opening up all the
datafiles (dbf) and indexes (cdx) that I would need to reference
throughout the application. I would also keep these files open
throughout the application.

I know how to declare and use SqlConnection, SqlDataAdapter, DataSet
to get a simple grid on a form. My problem occurs when I want to have
many different tables opened (many filtered) through out the application.

My questions:
- What is the equivalent way to do this in VB? (open several tables at
the start)

- Where and how do I declare the connections (SqlCon, DataAdapters,
Datset)? At the top of the main form? In a code module? As public
variable?

- Is it best to filter and sort tables via DataViews?

Thanks

Richard


Nov 21 '05 #4
Hi Cor,

I had a feeling that the designer method is just for beginners to learn
how to do things. Once you get beyond 2-3 tables, it gets more
complicated and I agree it is best to code things so you get a better
understanding as well as more control.
You can for that choose if you go the way of the designer method or do all
in code.
When you choose the desigener route, than you will probably see that after a
while you go to the coded way.
I like your description of a dataset. Things are starting to make more
sense now :) In both situations have a look first what is a dataset, as I try to describe
it beneath as simple that I can do.
Thanks for the tip. I was thinking about having a data adapter and
dataset for each table of the database. From your message, it appears
that I can put multiple tables in a single dataset and greatly simplify
things. I will do more experimenting with my test application using a
single dataset.
Therefore what method you take, keep an eye that you don't create all kind
of datasets. One is normally for your application enough (It can be that you
want to use it for by instance webservice or whatever. Than you will see
that you will create more).
Thanks again for the tip. I did a small test application where I loaded
500,000 rows of data into a dataset and then binded it to a datagrid. I
was able to then filter/sort that grid in seconds, but I realized I read
500,000 rows :)

From your message, it seems like a better idea to filter the request
before filling the dataset via the data adapter (from user input like
get only those rows for customer X from 2002-2004)

You are right, it seems to make more sense to work with smaller number
of rows and then make another read request for another set of rows.
And comming back on your main question. Because it is disconnected. Keep as
less data in your tables as you are possible to do, it is better to do more
times updates. And therefore don't start to load all your tables at your
client. When you work with Net try than to work as it was for a PDA or that
you had to sent the data over the Internet.

Yes, you have given me several ideas to test out. Thank you! I hope this gives some idea's?


Richard
Nov 21 '05 #5
Hi Dave,

Yes, I was 'thinking' about accessing some old DBF files that are still
being used.

Saying that, I've been reading a few great SQL books and I've
experimented by importing DBF files and the speed of SQL just blows me
away. While I have to experiment a bit more, at this point, I don't see
why everyone shouldn't import DBF into the more robust SQL format.

Of course, we all have to live with legacy applications and it would be
great to have a new VB/SQL application reference older DBF files in
parallel:)

I'll check out the link.
Thanks for the idea.

Richard

dave bray wrote:
Are you going to be using dbf tables ?
if so: we have common ground, in short this is a waste of time in
straight vb using oledb or similar, odbc is very slow on large dbf
tables (eg. > 100Mb)

the best article i've read on this was at http://www.west-wind.com/

post reading this, I've constructed my own dbf wrapper and am happily
still access data using very traditional seeks, open, closes

Nov 21 '05 #6

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

Similar topics

1
2023
by: Chris Uwins | last post by:
Hi there, i know theres a number of ways I can achieve this but want to know the best, (but still quite simple). Up until a year ago I never used Access but have designed a few databases for work. I am working on Access 2000. I have basic SQL/VB skills - and am pretty accomplished at putting the databases together. Anyway...I've created a database to keep track of "Dayworks" we are
11
1642
by: Paul Wagstaff | last post by:
Hi All Can I have some feedback on the best way to access data held in an mdb on a separate server over a LAN (and WAN for that matter). I currently use DoCmd to bring in the relevant tables linked to the external mdb & (tdf.delete to remove 'em when I'm done). I then use standard CurrentDB, db.OpenRecordset (strSQL), stuff to get at the treasure therein (being: 2 tables (1 - M) of c.1250 records comprising c.10 fields) . I'll need to...
4
2609
by: Daisy | last post by:
Let's say I've got a forum, where users can be moderators of each forum. Tables look like this: USER -------- user_key name FORUM
2
1704
by: John Smith | last post by:
Hey folks, I'm writing a Windows application which has many forms which have Datagrids on them to display data. These datagrids will not be editable in anyway. They are there to just view the results of a query (and perhaps double click on a row to open a new form). Additionally, the queries will often involve the use of 5 or more tables. Because efficiency (both speed and memory) is the primary concern what is the best method to...
0
4238
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET Applications and owner of Access Microsystems. Doug can be reached at doug@accessmicrosystems.com. --------------------------------------------------------------------------------
1
2362
by: py_genetic | last post by:
I have an H5 file with one group (off the root) and two large main tables and I'm attempting to aggragate my data into 50+ new groups (off the root) with two tables per sub group. sys info: PyTables version: 1.3.2 HDF5 version: 1.6.5 numarray version: 1.5.0 Zlib version: 1.2.3 BZIP2 version: 1.0.3 (15-Feb-2005)
13
2510
by: processoriented | last post by:
I am trying to find the best approach to do something here... situation is this... One of the tables in my dataset is a "Work Order" table with information about what needs to be done and where. Say my user goes on site to do the work associated with the work order, and while he is there, he discovers that the customer's phone number has changed. Should be no problem, he opens up the app, looks at his list of open work orders, finds the...
51
3647
by: bigHairy | last post by:
Hello. I have been teaching myself .NET over the last few months and have had some success. I would like to ask a question though... A number of examples I have followed have the following in their finally statement Try ......
1
1587
by: Rhadamanthys | last post by:
Hello All I am a relative beginner to SQL databases & new to this forum, so please bear with me if my query is too basic and advise if this question belongs somewhere else I began working at a company that uses a program that stores data in an SQL database running off a Firebird engine The program itself doesnt come with database management/administration module, so I'll need to use an external program for manipulating data in the...
0
8867
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, 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...
0
8740
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,...
0
9386
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, 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...
0
9090
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6685
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4503
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...
0
4764
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3208
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2148
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 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...

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.