Problem showing records in Columnar view

B

Behram

I've been using dotNet for some time now and understand
the basic concepts of data binding using datasets and
DataViews. However, I am experiencing an odd behaviour in
my program which I would like to explain below in plain
English first. I can post the code later on if required.
Please be patient with me as I try to explain my problem.
It's been haunting me for days.

First the basics ... I am using VB.Net with an MS Access
database in the backend. I am using OleDbDataAdapter to
populate my dataset. Also, there are no 3rd party
controls being used.

My Access database contains 2 tables - qMaster and
qVersion. For the sake of simplicity, let's say that each
record in the qMaster table can have anywhere upto 9
records (I'll call them Versions from now on) in the
qVersion table. The key field in "qMaster" is [QuoteNo]
and the key fields in "qVersion" are [QuoteNo] and
[QuoteVr]. "qMaster" and "qVersion" are linked to each
other via [QuoteNo]. I am able to create the
OleDbDataAdapter, populate it with data from my tables and
fill the DataSet with no problems at all. The problems
start thereafter ...

Here comes the first problem ... I would like to display
all 9 versions (records) side-by-side as columns just like
you would see in a spreadsheet, instead of showing them
down the rows (for which I could have easily used a
DataGrid). To achieve this goal, I created 9 DataViews
against the DataSet where the RowFilter for each DataView
is set to "QuoteVr=1", "QuoteVr=2", ... and so on. I've
created a User Control with assorted text boxes (let's say
10 in total) in it for each of the fields in
the "qVersion" table plus some extra calculated ones. I
copied the UserControl 9 times onto my form and DataBound
each UserControl to a different DataView. I've already
created properties for each of the fields/textBoxes in the
User Control so I can assign values and perform
DataBindings easily. These 9 UserControls are sitting on
the first TabPage of a TabControl on my form. On the
second TabPage of the TabControl, I then went ahead and
created 10 textBoxes same as what I did in the
UserControl. These 10 boxes on the second TabPage are
bound directly to the DataSet, so that I can navigate
through the DataSet using the DataBinding's Position
property. I am then capturing the "Enter" event of the
UserControl (which is data-bound to the DataView) to
determine which Version it is bound to and automatically
navigate to the desired record on the second TabPage by
setting the DataBinding's Position to the desired record
position. So far so good. (Just as an aside - is this
the best way to achieve my goal or is there an easier way
to do it, i.e. display records as columns! I do not
consider myself an expert and any help would be greatly
appreciated).

The problem starts when I start updating my textboxes. If
I do any direct input into any of the textBoxes either
within the UserControl on the first tabPage (bound to
DataViews) or to the textBoxes on the second tabPage
(bound directly to the DataSet), the values change
properly between the two tabPages. However, anywhere that
I use textBoxes to display calculated values end up
behaving oddly. The calculated values show up properly on
the 2nd tabPage (bound to DataSet directly) but when I hit
the Update button, here is what it does ... it will go
ahead and save any changed data that was directly input in
the textBoxes but will not update any of the calculated
textBox values. I know common logic dictates that you do
not need to save any calculated values back in the
database as you can recalculate these on-the-fly.
However, my application demands this for other reasons.
Also if I were to switch between the 2 tabPages I would
loose all my calculated values, but not the ones directly
entered. That's funny - I don't know how to explain this.
Say I had to work with 3 fields only, 2 input and 1
output - and initially the 2 input fields show the values
2 and 3 and the output box (which just adds the 2 numbers)
shows 5. Now if I change 2 to 4, the output box
correctly shows 7 on the 2nd tabPage but if I switch to
the 1st tabPage it reverts back to 5, but the input boxes
are still showing 4 and 3. If I save the value 4 is
correctly updated but the calculated value is not.


I'm at a total loss here. I've tried using EndCurrentEdit
but to no avail. I am guessing it has something to do
with the CurrencyManager but don't know what to do.

Please help.

Regards - Behram
 
D

Duke Sun

I'm now performing research on the issue. I will update you as soon as
possible.

Best regards,

Duke Sun
Microsoft Online Partner Support
<MCSE/MCDBA/MCSD>

Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
D

Duke Sun

Could you provide the sample to reproduce the issues? It will help us to
understand your concerns.

Best regards,

Duke Sun
Microsoft Online Partner Support
<MCSE/MCDBA/MCSD>

Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
D

Duke Sun

How is it going on your side? Could you provide the sample code to
reproduce the issue?

Best regards,

Duke Sun
Microsoft Online Partner Support
<MCSE/MCDBA/MCSD>

Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top