473,411 Members | 2,078 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,411 software developers and data experts.

Saving/loading a structured array from an Access database

This may reveal my poor programming skills, but here goes...

I'm building a pricing tool for my business. I'm nearing the end of the
project, and I've been asked to be able to save quotes in some sort of
database (Major Feature Creep). For each quote, I've got two kinds of
variables. The first are global for the quote, such as

numQuoteRows
QuoteFinalCost
CustomerID

Secondly, I've got the quote rows stored in a structured array, for example:

quoteRow(3).widgetHeight is the height of quote row 3 widget.
quoteRow(6).widgetQuantity is the number of widgets in quote row 6

The question is, how can load & save this info into an Access database. I
figure I can have one table with the global quote information, and one with
the quote rows, but I'm not sure how to feed the info to & from the database.

Please bear in mind I first picked up an intro to VB.NET book a little over
a year ago, and this is my first massive programming project. I've got Access
databases for customer info and all the widget pricing & configuration, so
descriptions of an Access interface would hopefully work. Many thanks for any
advice that you can provide.

--
Cary
Nov 21 '05 #1
2 1973
Cary,

The first thing you should do in my opinion is make from your array a
datatable.

Than it is so very simple doing what you ask.

In the most simple approach do you need than

An oledbconnection
dim conn as new oledb.oledbconnection(myconnectionstring)

For you connectionstring
http://www.connectionstrings.com/

a datatable
dim dt as new datatable

a dataadapter
dim da as new oledbdataadapter("Select * from mytable",conn)
da.fill(datatable)

an oledbcommandbuilder
dim cmb as new oledb.oledbcommandbuilder(da)
'this one builds the command and probably you never use it further however
with this the commands are build (when your selectstrings becomes complex
you cannot use it anymore however with your 2 fields it is probably great).

And when you have done your changes you do
da.update(datatable)

And then when you have no concurrent users and set all the error trapping
needed using try and catch, you are almost ready

I hope this helps?

Cor

"Cary" <Ca**@discussions.microsoft.com>
This may reveal my poor programming skills, but here goes...

I'm building a pricing tool for my business. I'm nearing the end of the
project, and I've been asked to be able to save quotes in some sort of
database (Major Feature Creep). For each quote, I've got two kinds of
variables. The first are global for the quote, such as

numQuoteRows
QuoteFinalCost
CustomerID

Secondly, I've got the quote rows stored in a structured array, for
example:

quoteRow(3).widgetHeight is the height of quote row 3 widget.
quoteRow(6).widgetQuantity is the number of widgets in quote row 6

The question is, how can load & save this info into an Access database. I
figure I can have one table with the global quote information, and one
with
the quote rows, but I'm not sure how to feed the info to & from the
database.

Please bear in mind I first picked up an intro to VB.NET book a little
over
a year ago, and this is my first massive programming project. I've got
Access
databases for customer info and all the widget pricing & configuration, so
descriptions of an Access interface would hopefully work. Many thanks for
any
advice that you can provide.

--
Cary

Nov 21 '05 #2


"Cary" <Ca**@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com...
This may reveal my poor programming skills, but here goes...

I'm building a pricing tool for my business. I'm nearing the end of the
project, and I've been asked to be able to save quotes in some sort of
database (Major Feature Creep). For each quote, I've got two kinds of
variables. The first are global for the quote, such as

numQuoteRows
QuoteFinalCost
CustomerID

Secondly, I've got the quote rows stored in a structured array, for
example:

quoteRow(3).widgetHeight is the height of quote row 3 widget.
quoteRow(6).widgetQuantity is the number of widgets in quote row 6

The question is, how can load & save this info into an Access database. I
figure I can have one table with the global quote information, and one
with
the quote rows, but I'm not sure how to feed the info to & from the
database.

Please bear in mind I first picked up an intro to VB.NET book a little
over
a year ago, and this is my first massive programming project. I've got
Access
databases for customer info and all the widget pricing & configuration, so
descriptions of an Access interface would hopefully work. Many thanks for
any
advice that you can provide.

--
Cary


Taking this from the very top...
As I understand it.

You have a 1 to many relationship between quote and rows.
So you want 2 tables

Quotes
Quote_Rows

You need to identify what Rows go with a quote, so you need the key to
Quotes as a field in Quote_Rows.
You can then do a join between them with your sql/query.

Quotes
Quote_Id ( Set as primary key )
whatever other fields

Quote_Rows
Quote_Row_Id ( As primary key )
Quote_Id
description
height
width
quantity
whatever other fields

Go into the relationships thing, add both tables and define the relationship
between the two.

I would suggest if you've done any access work then maybe you should stick
to that.

In access.
The simplest way is a subform for the rows in a form for the quotes.
You do that by designing a form for rows, set it to continuous form as
default view.
Stick all the data on one line in the detail section and size everything
else down if you can.
Make the form header and footer visible.
Put any totals fields in the footer as calculated fields, setting the
source to =sum(quote_row_whatever).
Stick field headings in the header.

Design your Quote screen.
Stick your fields on and get it looking OK ex the rows.
Set it to single form default view.
Then, drag and drop the row screen onto the quote screen.
It'll sort of automagically create the links between them.

--
Regards,
Andy O'Neill
Nov 21 '05 #3

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

Similar topics

3
by: C | last post by:
Re: Microsoft Knowledge Base Article - 870669 How to disable the ADODB.Stream object from Internet Explorer You may recently have heard of the vulnarability exposed by Internet Explorer as...
1
by: Inon Zukerman | last post by:
hello everyone. My problem is as follows : my application keeps a hashtable with Outlook.MailItem objects. I need to save and load this hashtable (with those objects inside) when starting and...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
6
by: Jeff | last post by:
Hey (and thank you for reading my post) In visual web developer 2005 express edition I've created a simple website project.. At this website I want users who register to be able to upload a...
6
by: Mark Denardo | last post by:
My question is similar to one someone posted a few months back, but I don't see any replies. Basically I want to be able to have users upload photos and save them in a database (as byte data)...
14
by: Simon | last post by:
I'm trying to write a little function to save data. Basically I have a large 2d array of structs, so I'm going to have to call the save function once per struct in the array. I'd like to save the...
3
by: Nathan Guill | last post by:
I have an interface that works with an Access back-end. I would like to store and/or load user defined query strings per each user (i.e. no user can access another's queries). The idea I had was...
12
by: einsanic | last post by:
Dear everyone, I am new to this forum and I am realitevely new to C programming so please forgive me for any basic mistakes I'll be making. I am trying to dynamically allocate the space for...
0
by: ne0lithic | last post by:
Hey everyone, I'm working on a program based on steganography. For this, i need to access the individual pixels and perform my manipulations. FYI, I do not have the JAI library available with me...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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,...
0
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...

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.