473,372 Members | 995 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,372 software developers and data experts.

Working with objects that are dependent on a database connection.

Hi all.
I'm migrating a small app from vb6 to vb.net. It basically deals with
invoices. This is the first time I do this kind of migration, from an
existing app to a new one, the new app should be as "object oriented" as
practically possible.

I have several objects that are dependent on a database connection, such as
the Invoice, the InvoiceDetail, a Currency object (mostly used to get real
time foreign currency exchange rate, and convert between currencies), etc.

A few questions:

1) What would be the recommended way of dealing with database persistence of
those objects? For example, before persisting a new invoice I should be able
to do some validiy/consistency checks, and then insert the corresponding
database lines within the context of a transaction. This is particularly
important, I need the Invoice and its corresponding InvoiceDetail to be
created correctly, or not at all. Is there a framework that will do that for
me?

2) How to correctly model that dependency of the objects on the database? I
will probably have only one database connection active for the client, and
all the operations regarding database access should use this one. Passing a
database connection as a parameter seems quite cumbersome (for example
invoice.persist(myDatabaseConnection)) so I guess all abjects should inherit
from some kind of super object, a "Session" object or such, so they all can
use the database connection when they need to. Am I right? Is there a better
solution?

3) VB.NET has lots of facilities regarding "connecting" GUI controls
directly to database items. I don't know whether I should use the facilities
it provides, or go on a fully separated layer/oriented architecture, which
is what I'm more accustomed to.

Thanks guys, your help is mostly appreciated.
Jul 21 '05 #1
0 988

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

Similar topics

3
by: viviane lima - * - * - | last post by:
Also idea ? how to use ASP for working .DBF files ? Please help me .. thanks Vivian
17
by: Gabriel Mejía | last post by:
Services or applications using ActiveX Data Objects (ADO) 2.0 or greater may intermittently return empty recordsets on queries that should be returning valid results. At the time the problem...
6
by: charliewest | last post by:
I have developed an application for WM 2003, which frequently transacts with a sql server ce 2.0 database. I have several procedures which utilize the following code: cn = new...
2
by: Frédéric Mayot | last post by:
Hi, In my web application, I need to connect to an SQL Server database. My pages (UI) will use one or more business objects as well as datareaders (I cannot make everything a business object...)...
0
by: Nico Raddatz | last post by:
Hi all. I'm migrating a small app from vb6 to vb.net. It basically deals with invoices. This is the first time I do this kind of migration, from an existing app to a new one, the new app should be...
0
by: NM | last post by:
Hello, I've got a problem inserting binary objects into the postgres database. I have binary objects (e.g. images or smth else) of any size which I want to insert into the database. Funny is it...
7
by: billelev | last post by:
Does anyone know if it is possible to close all objects in a database (tables, forms, queries etc.) using VBA code? I have not been able to find anything online to help me so far... My motivation...
16
by: Wayne | last post by:
I've read that one method of repairing a misbehaving database is to save all database objects as text and then rebuild them from the text files. I've used the following code posted by Lyle...
0
by: satyajit911 | last post by:
Hi, Can anyone please provide me information on how we can check which database objects(views, indexes, etc.) are dependent on a UDF. I want to drop a particular function & recreate a new one....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.