473,689 Members | 2,890 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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).wid getHeight is the height of quote row 3 widget.
quoteRow(6).wid getQuantity 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 1996
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.oledbconn ection(myconnec tionstring)

For you connectionstrin g
http://www.connectionstrings.com/

a datatable
dim dt as new datatable

a dataadapter
dim da as new oledbdataadapte r("Select * from mytable",conn)
da.fill(datatab le)

an oledbcommandbui lder
dim cmb as new oledb.oledbcomm andbuilder(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(datat able)

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**@discussio ns.microsoft.co m>
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).wid getHeight is the height of quote row 3 widget.
quoteRow(6).wid getQuantity 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**@discussio ns.microsoft.co m> wrote in message
news:5A******** *************** ***********@mic rosoft.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).wid getHeight is the height of quote row 3 widget.
quoteRow(6).wid getQuantity 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
9482
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 described in that article: "An ADO stream object contains methods for reading and writing binary files and text files. When an ADO stream object is combined with known security vulnerabilities in Internet Explorer, a Web site could execute scripts...
1
6477
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 terminating the application. I can't "serialize" them because Outlook.MailItem objects do not implement
4
6720
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 code ?? thank you Pedro Leite From Portugal ------------------------------------
6
8116
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 picture of themselves to their profile... I admit that I'm a newbie... but this is how I understand this:
6
6449
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) and be able to load them to an image webcontrol, but system.web.ui.webcontrols.image only seems to have a control to load the image from a URL. There's no way to load this directly without saving the image as a file and then using...
14
2054
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 data using fwrite(). After quite a lot of effort I've come up with the code below, but I'm having real difficulty getting rid of the last error. When compiling, I get this: Line 52: "warning: assignment makes pointer from integer without a...
3
1771
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 a "table" stored with the C# front-end (not in the Access database), but don't know if this is even possible. If it is, can someone let me know how? Otherwise, how do other people handle storing and loading query strings for possible later use?
12
2066
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 the global structured array of pointers that is available to all functions in my program. Since C doesn't allow open array arguments in funciton calls and I do not know the size of the array at compile time I am not sure how to pass this array to the...
0
2027
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 and I have to make do with awt, imageIO and image. I'm having no issues in loading an image but when i thought I would test things and just save the same image without manipulation I was surprised. After copying the pixels from the image into an int...
0
8528
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
9076
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
8947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8786
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...
0
5810
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4547
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2965
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
2
2219
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1952
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.